mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-08 00:27:05 +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 {
|
try {
|
||||||
// If just-in-time User Provisioning is enabled, try to create the DataHub user if it does not exist.
|
// If just-in-time User Provisioning is enabled, try to create the DataHub user if it does not exist.
|
||||||
if (oidcConfigs.isJitProvisioningEnabled()) {
|
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);
|
CorpUserSnapshot extractedUser = extractUser(corpUserUrn, profile);
|
||||||
if (oidcConfigs.isExtractGroupsEnabled()) {
|
if (oidcConfigs.isExtractGroupsEnabled()) {
|
||||||
// Extract groups & provision them.
|
// Extract groups & provision them.
|
||||||
@ -153,8 +153,7 @@ public class OidcCallbackLogic extends DefaultCallbackLogic<Result, PlayWebConte
|
|||||||
|
|
||||||
final Optional<String> mappedUserName = extractRegexGroup(
|
final Optional<String> mappedUserName = extractRegexGroup(
|
||||||
oidcConfigs.getUserNameClaimRegex(),
|
oidcConfigs.getUserNameClaimRegex(),
|
||||||
(String) profile.getAttribute(oidcConfigs.getUserNameClaim())
|
userNameClaim);
|
||||||
);
|
|
||||||
|
|
||||||
return mappedUserName.orElseThrow(() ->
|
return mappedUserName.orElseThrow(() ->
|
||||||
new RuntimeException(String.format("Failed to extract DataHub username from username claim %s using regex %s. Profile: %s",
|
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.setFirstName(firstName, SetMode.IGNORE_NULL);
|
||||||
userInfo.setLastName(lastName, SetMode.IGNORE_NULL);
|
userInfo.setLastName(lastName, SetMode.IGNORE_NULL);
|
||||||
userInfo.setFullName(String.format("%s %s", firstName, 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.
|
// If there is a display name, use it. Otherwise fall back to full name.
|
||||||
userInfo.setDisplayName(displayName == null ? userInfo.getFullName() : displayName, SetMode.IGNORE_NULL);
|
userInfo.setDisplayName(displayName == null ? userInfo.getFullName() : displayName, SetMode.IGNORE_NULL);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user