You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kompass/jdav_web/logindata/oauth.py

14 lines
497 B
Python

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):
if request.user.member:
context = {'email': request.user.member.email}
else:
context = {}
return dict(context, preferred_username=request.user.username)