Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nextcloud provider #179

Merged
merged 2 commits into from
Dec 17, 2019
Merged

Conversation

Ramblurr
Copy link

@Ramblurr Ramblurr commented Jun 5, 2019

Description

This PR adds the Nextcloud provider, that allows for authentication of users on a Nextcloud instance.

Motivation and Context

For some time now Nextcloud has had an Oauth2 implementation that allows for arbitrary 3rd party tools to act as oauth2 clients and perform authentication for users hosted on the Nextcloud instance.

Docs: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/oauth2.html

How Has This Been Tested?

  • I've included a test suite
  • I'm running this in production on a large Nextcloud instance

Checklist

  • My change requires a change to the documentation or CHANGELOG.
  • I have updated the documentation/CHANGELOG accordingly.
  • I have created a feature (non-master) branch for my PR.

@Ramblurr Ramblurr requested a review from a team June 5, 2019 17:05
@Ramblurr Ramblurr changed the title add nextcloud provider Add nextcloud provider Jun 5, 2019
Copy link
Member

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ramblurr Thanks for adding this support. I'm happy for us to support this but as I have no way to test this, could you please add yourself to the CODEOWNERS file taking ownership of the relevant files. This way if there are any issues with it, people should be able to ping you?

CHANGELOG.md Outdated Show resolved Hide resolved
@Ramblurr
Copy link
Author

Thanks for the review. I'm leaving for vacation soon, so I'll get back to this in several weeks.

Ramblurr added a commit to Ramblurr/oauth2_proxy that referenced this pull request Sep 5, 2019
Ramblurr added a commit to Ramblurr/oauth2_proxy that referenced this pull request Sep 5, 2019
Ramblurr added a commit to Ramblurr/oauth2_proxy that referenced this pull request Sep 5, 2019
@Ramblurr
Copy link
Author

Ramblurr commented Sep 5, 2019

I'm back at this again, sorry for the delay @JoelSpeed.

I rebased and patched my PR given the recent shakeup for 4.0.0, and I've made the requested changes.

The Travis build is failing due to a linting error in code I didn't touch:

GO111MODULE=on "/home/travis/gopath/bin/golangci-lint" run
providers/azure_test.go:116:47: string `Bearer imaginary_access_token` has 3 occurrences, make it a constant (goconst)

			} else if r.Header.Get("Authorization") != "Bearer imaginary_access_token" {
			                                           ^
Makefile:20: recipe for target 'lint' failed
make: *** [lint] Error 1
The command "./configure && make test" exited with 2.

This is code in master already.

If I disable linting and run just the tests, they pass fine locally.

@steakunderscore
Copy link
Contributor

} else if r.Header.Get("Authorization") != "Bearer imaginary_access_token" {
This came up somewhere else in the repo. Just change the string so it's unique. Could use something like azure_imaginary_access_token. I think this should fix it.

@Ramblurr
Copy link
Author

Ramblurr commented Sep 5, 2019

Should I add that as a commit to this PR?

@ploxiln
Copy link
Contributor

ploxiln commented Sep 6, 2019

In the function testNextcloudBackend() you added the line:

			} else if r.Header.Get("Authorization") != "Bearer imaginary_access_token" {

and that is what caused this dumb linter rule to be triggered. So to quiet the rule, you can change your tests to use a different mock access token string.

Ramblurr added a commit to Ramblurr/oauth2_proxy that referenced this pull request Sep 10, 2019
Ramblurr added a commit to Ramblurr/oauth2_proxy that referenced this pull request Sep 10, 2019
@Ramblurr
Copy link
Author

Oh! I see, the linter is comparing the strings across the entire project. Sorry about that. That explains why this isn't present on master :)

Pushed the fix.

Copy link
Contributor

@loshz loshz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few tiny nits (sorry).

Are you ok to add yourself to the CODEOWNERS for this provider? Totally optional of course 😄

docs/2_auth.md Outdated Show resolved Hide resolved
providers/nextcloud.go Outdated Show resolved Hide resolved
Ramblurr added a commit to Ramblurr/oauth2_proxy that referenced this pull request Sep 12, 2019
@Ramblurr
Copy link
Author

Ramblurr commented Sep 12, 2019

Added a few tiny nits (sorry).

fixed!

Are you ok to add yourself to the CODEOWNERS for this provider? Totally optional of course 😄

If you're referring to .github/CODEOWNERS, then I've already added myself there :)

loshz
loshz previously approved these changes Sep 12, 2019
Copy link
Contributor

@loshz loshz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@loshz
Copy link
Contributor

loshz commented Oct 24, 2019

This has been open for a while so let's get the changelog conflicts resolved and we can merge.

@JoelSpeed: if you've time to re-review then that would be great!

Ramblurr added a commit to Ramblurr/oauth2_proxy that referenced this pull request Oct 28, 2019
@Ramblurr
Copy link
Author

Fixed the CHANGELOG conflict.

loshz
loshz previously approved these changes Oct 28, 2019
Copy link
Contributor

@loshz loshz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you and congrats on your first contribution! 🎉

Copy link
Member

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One quick question about the docs, I may not be understanding fully though

docs/2_auth.md Outdated
-provider nextcloud
-client-id <from nextcloud admin>
-client-secret <from nextcloud admin>
-login-url="<your gitlab url>/index.php/apps/oauth2/authorize"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be gitlab or nextcloud here? Looks like maybe a copy paste error?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, you are right. Should definitely be nextcloud.

Ramblurr added a commit to Ramblurr/oauth2_proxy that referenced this pull request Nov 25, 2019
@Ramblurr
Copy link
Author

Fixed doc typo and rebased master.

Copy link
Member

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog entry is in the wrong place right now but I'll fix that up later, thanks @Ramblurr for being patient with us!

@JoelSpeed JoelSpeed merged commit bb55b13 into oauth2-proxy:master Dec 17, 2019
Jing-ze pushed a commit to Jing-ze/oauth2-proxy that referenced this pull request Nov 19, 2024
Co-authored-by: Xunzhuo <bitliu@tencent.com>
T-vK pushed a commit to T-vK/oauth2-proxy that referenced this pull request Nov 20, 2024
…re/bumpredischart

Bump redis chart version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants