mirror of
https://github.com/theonedev/onedev.git
synced 2026-02-01 17:37:19 +00:00
fix: Referencing users if username contains @ sign (OD-2038)
This commit is contained in:
parent
260c5cce2d
commit
9672ba0c45
@ -241,18 +241,15 @@ public class OpenIdConnector extends SsoConnector {
|
||||
if (!subject.equals(json.get("sub")))
|
||||
throw new AuthenticationException("OIDC error: Inconsistent sub in ID token and userinfo");
|
||||
|
||||
if (email == null) {
|
||||
if (email == null)
|
||||
email = getStringValue(json.get("email"));
|
||||
if (email == null)
|
||||
throw new AuthenticationException("OIDC error: No email claim returned");
|
||||
}
|
||||
if (email == null)
|
||||
throw new AuthenticationException("OIDC error: No email claim returned");
|
||||
|
||||
if (userName == null) {
|
||||
if (userName == null)
|
||||
userName = getStringValue(json.get("preferred_username"));
|
||||
if (userName == null)
|
||||
userName = email;
|
||||
userName = StringUtils.substringBefore(userName, "@");
|
||||
}
|
||||
if (userName == null)
|
||||
userName = email;
|
||||
|
||||
if (fullName == null)
|
||||
fullName = getStringValue(json.get("name"));
|
||||
@ -271,6 +268,7 @@ public class OpenIdConnector extends SsoConnector {
|
||||
throw buildException(UserInfoErrorResponse.parse(httpResponse).getErrorObject());
|
||||
}
|
||||
}
|
||||
userName = StringUtils.substringBefore(userName, "@");
|
||||
if (groups != null)
|
||||
groups = convertGroups(accessToken, groups);
|
||||
return new SsoAuthenticated(userName, email, fullName, groups, null, this);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user