[picketlink-commits] Picketlink SVN: r1169 - federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp.

picketlink-commits at lists.jboss.org picketlink-commits at lists.jboss.org
Wed Aug 10 12:42:40 EDT 2011


Author: anil.saldhana at jboss.com
Date: 2011-08-10 12:42:40 -0400 (Wed, 10 Aug 2011)
New Revision: 1169

Modified:
   federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPUtil.java
Log:
remove redundant method

Modified: federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPUtil.java
===================================================================
--- federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPUtil.java	2011-08-10 16:42:15 UTC (rev 1168)
+++ federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/sp/SPUtil.java	2011-08-10 16:42:40 UTC (rev 1169)
@@ -22,7 +22,6 @@
 package org.picketlink.identity.federation.bindings.tomcat.sp;
 
 import java.security.Principal;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.catalina.Context;
@@ -32,20 +31,7 @@
 import org.picketlink.identity.federation.core.ErrorCodes;
 import org.picketlink.identity.federation.core.exceptions.ConfigurationException;
 import org.picketlink.identity.federation.core.saml.v2.common.IDGenerator;
-import org.picketlink.identity.federation.core.saml.v2.common.StatementLocal;
-import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
-import org.picketlink.identity.federation.core.saml.v2.exceptions.AssertionExpiredException;
-import org.picketlink.identity.federation.core.saml.v2.util.AssertionUtil;
-import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeStatementType;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeStatementType.ASTChoiceType;
-import org.picketlink.identity.federation.saml.v2.assertion.AttributeType;
-import org.picketlink.identity.federation.saml.v2.assertion.NameIDType;
-import org.picketlink.identity.federation.saml.v2.assertion.SubjectType;
 import org.picketlink.identity.federation.saml.v2.protocol.AuthnRequestType;
-import org.picketlink.identity.federation.saml.v2.protocol.ResponseType;
-import org.picketlink.identity.federation.saml.v2.protocol.ResponseType.RTChoiceType;
-import org.picketlink.identity.federation.saml.v2.protocol.StatusType;
 
 /**
  * Common code useful for a SP
@@ -73,62 +59,6 @@
       return saml2Request.createAuthnRequestType(id, serviceURL, identityURL, serviceURL);
    }
 
-   /**
-    * Handle the SAMLResponse from the IDP
-    * @param request entire request from IDP
-    * @param responseType ResponseType that has been generated
-    * @param serverEnvironment tomcat,jboss etc
-    * @return   
-    * @throws AssertionExpiredException 
-    */
-   public Principal handleSAMLResponse(Request request, ResponseType responseType) throws ConfigurationException,
-         AssertionExpiredException
-   {
-      if (request == null)
-         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "request");
-      if (responseType == null)
-         throw new IllegalArgumentException(ErrorCodes.NULL_ARGUMENT + "response type");
-
-      StatusType statusType = responseType.getStatus();
-      if (statusType == null)
-         throw new IllegalArgumentException(ErrorCodes.NULL_VALUE + "Status Type from the IDP");
-
-      String statusValue = statusType.getStatusCode().getValue().toASCIIString();
-      if (JBossSAMLURIConstants.STATUS_SUCCESS.get().equals(statusValue) == false)
-         throw new SecurityException(ErrorCodes.IDP_AUTH_FAILED);
-
-      List<RTChoiceType> assertions = responseType.getAssertions();
-      if (assertions.size() == 0)
-         throw new IllegalStateException(ErrorCodes.NULL_VALUE + "No assertions in reply from IDP");
-
-      AssertionType assertion = assertions.get(0).getAssertion();
-      //Check for validity of assertion
-      boolean expiredAssertion = AssertionUtil.hasExpired(assertion);
-      if (expiredAssertion)
-         throw new AssertionExpiredException();
-
-      SubjectType subject = assertion.getSubject();
-
-      //JAXBElement<NameIDType> jnameID = (JAXBElement<NameIDType>) subject.getContent().get(0);
-      NameIDType nameID = (NameIDType) subject.getSubType().getBaseID();
-      String userName = nameID.getValue();
-      List<String> roles = new ArrayList<String>();
-
-      //Set it on a thread local for JBID integrators
-      StatementLocal.statements.set(assertion.getStatements());
-
-      //Let us get the roles
-      AttributeStatementType attributeStatement = (AttributeStatementType) assertion.getStatements().iterator().next();
-      List<ASTChoiceType> attList = attributeStatement.getAttributes();
-      for (ASTChoiceType obj : attList)
-      {
-         AttributeType attr = obj.getAttribute();
-         String roleName = (String) attr.getAttributeValue().get(0);
-         roles.add(roleName);
-      }
-      return this.createGenericPrincipal(request, userName, roles);
-   }
-
    public Principal createGenericPrincipal(Request request, String username, List<String> roles)
    {
       Context ctx = request.getContext();



More information about the picketlink-commits mailing list