-
Notifications
You must be signed in to change notification settings - Fork 364
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
Adding oauth2 generic RFC authentication #60
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolves #59
|
||
class OAuth2EnvMixin(OAuth2Mixin): | ||
_OAUTH_ACCESS_TOKEN_URL = os.environ.get('OAUTH2_TOKEN_URL', '') | ||
_OAUTH_AUTHORIZE_URL = os.environ.get('OAUTH2_AUTHORIZE_URL', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could I get these attributes using trailets?
I really don't know a better solution than env vars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Env vars are the only thing really available at this level, so this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks! I made some minor comments about the organization, but this seems super useful.
@@ -1,104 +1,135 @@ | |||
""" | |||
Base classes for Custom Authenticator to use GitHub OAuth with JupyterHub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid confusion / compatibility, can you put the new class in oauthenticator/generic.py
, rather than changing what oauthenticator.oauth2
provides and means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did
) | ||
|
||
token_url = Unicode( | ||
os.environ.get('OAUTH2_USERDATA_METHOD', 'GET'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy/paste USERDATA_METHOD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
pass | ||
|
||
|
||
class OAuth2OAuthenticator(OAuthenticator): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use Generic
as the name, too? GenericOAuthenticator
, etc.?
@@ -1,6 +1,7 @@ | |||
# include github, bitbucket, google here for backward-compatibility | |||
# don't add new oauthenticators here. | |||
from .oauth2 import * | |||
from .generic import * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment above for 'don't add new things here'. Authenticators should be imported directly from their submodule, so that we don't import all the unused Authenticators as this package grows.
|
||
login_service = "OAuth2" | ||
|
||
client_id_env = 'OAUTH2_CLIENT_ID' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can leave the defaults from the parent class, of OAUTH_...
I think it's now ready ;) Really thx |
I'm using here and it's working ;) |
Thanks! |
Following https://tools.ietf.org/html/rfc6749