mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-05 15:13:21 +00:00
fix(oidc): Tolerate null emails (#3330)
This commit is contained in:
parent
61ba3cf578
commit
fe589a58b3
@ -109,7 +109,7 @@ public class OidcCallbackLogic extends DefaultCallbackLogic<Result, PlayWebConte
|
||||
try {
|
||||
// If just-in-time User Provisioning is enabled, try to create the DataHub user if it does not exist.
|
||||
if (oidcConfigs.isJitProvisioningEnabled()) {
|
||||
log.debug("Just-in-time provisioning is enabled. Beginning provisioning proces...");
|
||||
log.debug("Just-in-time provisioning is enabled. Beginning provisioning process...");
|
||||
CorpUserSnapshot extractedUser = extractUser(corpUserUrn, profile);
|
||||
if (oidcConfigs.isExtractGroupsEnabled()) {
|
||||
// Extract groups & provision them.
|
||||
@ -153,8 +153,7 @@ public class OidcCallbackLogic extends DefaultCallbackLogic<Result, PlayWebConte
|
||||
|
||||
final Optional<String> mappedUserName = extractRegexGroup(
|
||||
oidcConfigs.getUserNameClaimRegex(),
|
||||
(String) profile.getAttribute(oidcConfigs.getUserNameClaim())
|
||||
);
|
||||
userNameClaim);
|
||||
|
||||
return mappedUserName.orElseThrow(() ->
|
||||
new RuntimeException(String.format("Failed to extract DataHub username from username claim %s using regex %s. Profile: %s",
|
||||
@ -185,7 +184,7 @@ public class OidcCallbackLogic extends DefaultCallbackLogic<Result, PlayWebConte
|
||||
userInfo.setFirstName(firstName, SetMode.IGNORE_NULL);
|
||||
userInfo.setLastName(lastName, SetMode.IGNORE_NULL);
|
||||
userInfo.setFullName(String.format("%s %s", firstName, lastName), SetMode.IGNORE_NULL);
|
||||
userInfo.setEmail(email);
|
||||
userInfo.setEmail(email, SetMode.IGNORE_NULL);
|
||||
// If there is a display name, use it. Otherwise fall back to full name.
|
||||
userInfo.setDisplayName(displayName == null ? userInfo.getFullName() : displayName, SetMode.IGNORE_NULL);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user