Merge pull request #3841 from jumpserver/dev

Dev
pull/3860/head
BaiJiangJie 5 years ago committed by GitHub
commit 7977294c5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,7 +19,7 @@ JumpServer 采纳分布式架构,支持多机房跨区域部署,支持横向
<table>
<tr>
<td rowspan="7">身份认证<br>Authentication</td>
<td rowspan="8">身份认证<br>Authentication</td>
<td rowspan="5">登录认证</td>
<td>资源统一登录与认证</td>
</tr>

@ -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(

Loading…
Cancel
Save