[jboss-cvs] Picketlink SVN: r320 - federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jun 30 17:29:22 EDT 2010


Author: anil.saldhana at jboss.com
Date: 2010-06-30 17:29:21 -0400 (Wed, 30 Jun 2010)
New Revision: 320

Modified:
   federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java
Log:
PLFED-93: do not assume role to be of String object type

Modified: federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java
===================================================================
--- federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java	2010-06-27 20:57:26 UTC (rev 319)
+++ federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/handlers/saml2/SAML2AuthenticationHandler.java	2010-06-30 21:29:21 UTC (rev 320)
@@ -63,6 +63,7 @@
 import org.picketlink.identity.federation.web.core.IdentityServer;
 import org.picketlink.identity.federation.web.interfaces.IRoleValidator;
 import org.w3c.dom.Document;
+import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
 
 /**
@@ -370,8 +371,23 @@
          for(Object obj:attList)
          {
             AttributeType attr = (AttributeType) obj;
-            String roleName = (String) attr.getAttributeValue().get(0);
-            roles.add(roleName);
+            List<Object> attributeValues = attr.getAttributeValue();
+            if( attributeValues != null)
+            {
+               for( Object attrValue : attributeValues )
+               {
+                  if( attrValue instanceof String )
+                  {
+                     roles.add( (String) attrValue ); 
+                  }
+                  else if( attrValue instanceof Node )
+                  {
+                     Node roleNode = (Node) attrValue;
+                     roles.add( roleNode.getFirstChild().getNodeValue() );
+                  }
+                  else throw new RuntimeException( "Unknown role object type : " +  attrValue ); 
+               }
+            } 
          }
          
          response.setRoles(roles);



More information about the jboss-cvs-commits mailing list