cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1434630 - /cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java
Date Thu, 17 Jan 2013 12:04:50 GMT
Author: coheigea
Date: Thu Jan 17 12:04:50 2013
New Revision: 1434630

URL: http://svn.apache.org/viewvc?rev=1434630&view=rev
Log:
[FEDIZ-45] - Refactor of previous commit

Modified:
    cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java

Modified: cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java?rev=1434630&r1=1434629&r2=1434630&view=diff
==============================================================================
--- cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java
(original)
+++ cxf/fediz/trunk/plugins/core/src/main/java/org/apache/cxf/fediz/core/saml/SAMLTokenValidator.java
Thu Jan 17 12:04:50 2013
@@ -185,16 +185,16 @@ public class SAMLTokenValidator implemen
                 for (Claim c : claims) {
                     if (roleURI.equals(c.getClaimType())) {
                         Object oValue = c.getValue();
-                        if (oValue instanceof String) {
+                        if ((oValue instanceof String) && !"".equals((String)oValue))
{
                             if (delim == null) {
                                 roles = Collections.singletonList((String)oValue);
                             } else {
                                 roles = parseRoles((String)oValue, delim);
                             }
-                        } else if (oValue instanceof List<?>) {
+                        } else if ((oValue instanceof List<?>) && !((List<?>)oValue).isEmpty())
{
                             List<String> values = (List<String>)oValue;
                             roles = Collections.unmodifiableList(values);
-                        } else {
+                        } else if (!((oValue instanceof String) || (oValue instanceof List<?>)))
{
                             LOG.error("Unsupported value type of Claim value");
                             throw new IllegalStateException("Unsupported value type of Claim
value");
                         }
@@ -279,9 +279,7 @@ public class SAMLTokenValidator implemen
                     if (LOG.isDebugEnabled()) {
                         LOG.debug(" [" + value + "]");
                     }
-                    if (!"".equals(value)) {
-                        valueList.add(value);
-                    }
+                    valueList.add(value);
                 }
                 mergeClaimToMap(claimsMap, c, valueList);
             }
@@ -337,9 +335,7 @@ public class SAMLTokenValidator implemen
                     if (LOG.isDebugEnabled()) {
                         LOG.debug(" [" + value + "]");
                     }
-                    if (!"".equals(value)) {
-                        valueList.add(value);
-                    }
+                    valueList.add(value);
                 }
                 mergeClaimToMap(claimsMap, c, valueList);
             }



Mime
View raw message