feat: oauth provider
parent
de95c76ac7
commit
7c5152c5b0
@ -0,0 +1,11 @@
|
||||
OAUTH2_PROVIDER = {
|
||||
"OIDC_ENABLED": True,
|
||||
"PKCE_REQUIRED": False,
|
||||
"OAUTH2_VALIDATOR_CLASS": "logindata.oauth.CustomOAuth2Validator",
|
||||
"OIDC_RSA_PRIVATE_KEY": get_var('oauth', 'oidc_rsa_private_key', default=''),
|
||||
"SCOPES": {
|
||||
"openid": "OpenID Connect scope",
|
||||
"profile": "profile scope",
|
||||
"email": "email scope",
|
||||
},
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
from oauth2_provider.oauth2_validators import OAuth2Validator
|
||||
|
||||
|
||||
class CustomOAuth2Validator(OAuth2Validator):
|
||||
# Set `oidc_claim_scope = None` to ignore scopes that limit which claims to return,
|
||||
# otherwise the OIDC standard scopes are used.
|
||||
|
||||
def get_additional_claims(self, request):
|
||||
return {
|
||||
"preferred_username": request.user.username
|
||||
}
|
||||
Loading…
Reference in New Issue