diff --git a/README.md b/README.md index 76465a36e..052952256 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ JumpServer 采纳分布式架构,支持多机房跨区域部署,支持横向 - + diff --git a/apps/authentication/backends/openid/models.py b/apps/authentication/backends/openid/models.py index 4a43c06fa..ca50ee266 100644 --- a/apps/authentication/backends/openid/models.py +++ b/apps/authentication/backends/openid/models.py @@ -5,6 +5,7 @@ from django.db import transaction from django.contrib.auth import get_user_model from keycloak.realm import KeycloakRealm from keycloak.keycloak_openid import KeycloakOpenID +from users.utils import construct_user_email from .signals import post_create_or_update_openid_user from .decorator import ssl_verification @@ -155,13 +156,17 @@ class Client(object): """ userinfo = self.get_userinfo(token=token_response['access_token']) with transaction.atomic(): + name = userinfo.get('name', '') + username = userinfo.get('preferred_username', ''), + email = userinfo.get('email', '') + email = construct_user_email(username, email) + user, created = get_user_model().objects.update_or_create( - username=userinfo.get('preferred_username', ''), + username=username, defaults={ - 'email': userinfo.get('email', ''), + 'name': name, 'email': email, 'first_name': userinfo.get('given_name', ''), 'last_name': userinfo.get('family_name', ''), - 'name': userinfo.get('name', '') } ) oidt_profile = OpenIDTokenProfile(
身份认证
Authentication
身份认证
Authentication
登录认证 资源统一登录与认证