mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-29 11:23:17 +00:00
fix: 修复oidc认证不区分大小写 (#8267)
Co-authored-by: feng626 <1304903146@qq.com>
This commit is contained in:
parent
aa7540045b
commit
c8d7c7c56f
@ -281,6 +281,11 @@ class OIDCAuthPasswordBackend(OIDCBaseBackend):
|
|||||||
try:
|
try:
|
||||||
claims_response.raise_for_status()
|
claims_response.raise_for_status()
|
||||||
claims = claims_response.json()
|
claims = claims_response.json()
|
||||||
|
preferred_username = claims.get('preferred_username')
|
||||||
|
if preferred_username and \
|
||||||
|
preferred_username.lower() == username.lower() and \
|
||||||
|
preferred_username != username:
|
||||||
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error = "Json claims response error, claims response " \
|
error = "Json claims response error, claims response " \
|
||||||
"content is: {}, error is: {}".format(claims_response.content, str(e))
|
"content is: {}, error is: {}".format(claims_response.content, str(e))
|
||||||
@ -309,5 +314,3 @@ class OIDCAuthPasswordBackend(OIDCBaseBackend):
|
|||||||
openid_user_login_failed.send(
|
openid_user_login_failed.send(
|
||||||
sender=self.__class__, request=request, username=username, reason="User is invalid"
|
sender=self.__class__, request=request, username=username, reason="User is invalid"
|
||||||
)
|
)
|
||||||
return None
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user