jfrazee commented on a change in pull request #4630:
URL: https://github.com/apache/nifi/pull/4630#discussion_r552954964



##########
File path: 
nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java
##########
@@ -1011,6 +1012,21 @@ public String getOidcClaimIdentifyingUser() {
         return getProperty(SECURITY_USER_OIDC_CLAIM_IDENTIFYING_USER, 
"email").trim();
     }
 
+    /**
+     * Returns the list of fallback claims to be used to identify a user when 
the configured claim is empty for a user
+     *
+     * @return The list of fallback claims to be used to identify the user
+     */
+    public List<String> getOidcFallbackClaimsIdentifyingUser() {
+        String rawProperty = 
getProperty(SECURITY_USER_OIDC_FALLBACK_CLAIMS_IDENTIFYING_USER, "").trim();
+        if (rawProperty.isEmpty()) {

Review comment:
       ```suggestion
           if (StringUtils.isBlank(rawProperty)) {
   ```

##########
File path: 
nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java
##########
@@ -1011,6 +1012,21 @@ public String getOidcClaimIdentifyingUser() {
         return getProperty(SECURITY_USER_OIDC_CLAIM_IDENTIFYING_USER, 
"email").trim();
     }
 
+    /**
+     * Returns the list of fallback claims to be used to identify a user when 
the configured claim is empty for a user
+     *
+     * @return The list of fallback claims to be used to identify the user
+     */
+    public List<String> getOidcFallbackClaimsIdentifyingUser() {
+        String rawProperty = 
getProperty(SECURITY_USER_OIDC_FALLBACK_CLAIMS_IDENTIFYING_USER, "").trim();
+        if (rawProperty.isEmpty()) {
+            return Collections.emptyList();
+        } else {
+            List<String> fallbackClaims = 
Arrays.asList(rawProperty.split(","));
+            return 
fallbackClaims.stream().map(String::trim).collect(Collectors.toList());

Review comment:
       This allows empty fallback claims to come through for strings like 
`",a,b,"`.
   ```suggestion
               return fallbackClaims.stream().map(String::trim).filter(s -> 
!s.isEmpty()).collect(Collectors.toList());
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to