Skip to content
Snippets Groups Projects
Commit b5bcef8f authored by Pomucz Tamás András's avatar Pomucz Tamás András
Browse files

Revert "Use schacc as email"

This reverts commit 5c0639ac.
parent 5c0639ac
No related branches found
No related tags found
No related merge requests found
Pipeline #51665 passed
...@@ -4,17 +4,10 @@ from common.email import registration ...@@ -4,17 +4,10 @@ from common.email import registration
class JSOIDCAuthBackend(OIDCAuthenticationBackend): class JSOIDCAuthBackend(OIDCAuthenticationBackend):
def get_email(self, claims):
sam_account_name = claims.get('directory.sch.bme.hu:sAMAccountName')
if sam_account_name:
return f"{sam_account_name}@sch.bme.hu"
return ""
def create_user(self, claims): def create_user(self, claims):
user = super(JSOIDCAuthBackend, self).create_user(claims) user = super(JSOIDCAuthBackend, self).create_user(claims)
user.first_name = claims.get('given_name', '') user.first_name = claims.get('given_name', '')
user.last_name = claims.get('family_name', '') user.last_name = claims.get('family_name', '')
user.email = self.get_email(claims)
user.save() user.save()
models.Profile.objects.create(user=user) models.Profile.objects.create(user=user)
if user.email is not None: if user.email is not None:
......
...@@ -154,7 +154,7 @@ OIDC_OP_TOKEN_ENDPOINT = os.environ.get('OIDC_TOKEN_ENDPOINT') ...@@ -154,7 +154,7 @@ OIDC_OP_TOKEN_ENDPOINT = os.environ.get('OIDC_TOKEN_ENDPOINT')
OIDC_OP_USER_ENDPOINT = os.environ.get('OIDC_USERINFO_ENDPOINT') OIDC_OP_USER_ENDPOINT = os.environ.get('OIDC_USERINFO_ENDPOINT')
OIDC_OP_JWKS_ENDPOINT = os.environ.get('OIDC_JWKS_ENDPOINT') OIDC_OP_JWKS_ENDPOINT = os.environ.get('OIDC_JWKS_ENDPOINT')
OIDC_RP_SIGN_ALGO = os.environ.get('OIDC_SIGN_ALGO', 'RS256') OIDC_RP_SIGN_ALGO = os.environ.get('OIDC_SIGN_ALGO', 'RS256')
OIDC_RP_SCOPES = os.environ.get('OIDC_RP_SCOPES', 'openid email profile offline_access directory.sch.bme.hu:sAMAccountName') OIDC_RP_SCOPES = os.environ.get('OIDC_RP_SCOPES', 'openid email profile offline_access')
OIDC_VERIFY_KID = False OIDC_VERIFY_KID = False
OIDC_EXEMPT_URLS = ["/healthz/", "/admin/", "/oidc/"] OIDC_EXEMPT_URLS = ["/healthz/", "/admin/", "/oidc/"]
LOGIN_REDIRECT_URL = "/" LOGIN_REDIRECT_URL = "/"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment