Mistakenly used SAML 1 query as top level request element, correct that
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 27 Jun 2007 18:36:04 +0000 (18:36 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 27 Jun 2007 18:36:04 +0000 (18:36 +0000)
Synch up with attribute resolver request context change
Use Shibboleth profile based SAML 1 message security rule in default config

git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2276 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

resources/conf/internal.xml
src/edu/internet2/middleware/shibboleth/idp/profile/saml1/AbstractSAML1ProfileHandler.java
src/edu/internet2/middleware/shibboleth/idp/profile/saml1/AttributeQueryProfileHandler.java
src/edu/internet2/middleware/shibboleth/idp/profile/saml1/ShibbolethSSOProfileHandler.java
src/edu/internet2/middleware/shibboleth/idp/profile/saml2/AbstractSAML2ProfileHandler.java

index 52b5669..e61aaaa 100644 (file)
     
     <bean id="shibboleth.SAML2ProtocolMessageRuleFactory" class="org.opensaml.saml2.binding.security.SAML2ProtocolMessageRuleFactory" />
     
-    <bean id="shibboleth.SAML1ProtocolMessageRuleFactory" class="org.opensaml.saml1.binding.security.SAML1ProtocolMessageRuleFactory" />
+    <bean id="shibboleth.SAML1ProtocolMessageRuleFactory" class="edu.internet2.middleware.shibboleth.common.binding.security.ShibbolethSAML1ProtocolMessageRuleFactory" />
     
     <bean id="shibboleth.MessageIssueInstantRuleFactory" class="org.opensaml.common.binding.security.IssueInstantRuleFactory">
         <property name="clockSkew" value="5" />
index 76d5cff..681ac3e 100644 (file)
@@ -39,6 +39,7 @@ import org.opensaml.saml1.core.AudienceRestrictionCondition;
 import org.opensaml.saml1.core.Conditions;
 import org.opensaml.saml1.core.ConfirmationMethod;
 import org.opensaml.saml1.core.NameIdentifier;
+import org.opensaml.saml1.core.Request;
 import org.opensaml.saml1.core.RequestAbstractType;
 import org.opensaml.saml1.core.Response;
 import org.opensaml.saml1.core.ResponseAbstractType;
@@ -674,13 +675,14 @@ public abstract class AbstractSAML1ProfileHandler extends AbstractSAMLProfileHan
 
         ShibbolethSAMLAttributeRequestContext<NameIdentifier, AttributeQuery> queryContext;
 
-        if (requestContext.getSamlRequest() instanceof AttributeQuery) {
+        if (requestContext.getSamlRequest() instanceof Request) {
+            Request samlRequest = (Request) requestContext.getSamlRequest();
             queryContext = new ShibbolethSAMLAttributeRequestContext<NameIdentifier, AttributeQuery>(
                     getMetadataProvider(), requestContext.getRelyingPartyConfiguration(),
-                    (AttributeQuery) requestContext.getSamlRequest());
+                    samlRequest.getAttributeQuery());
         } else {
             queryContext = new ShibbolethSAMLAttributeRequestContext<NameIdentifier, AttributeQuery>(
-                    getMetadataProvider(), requestContext.getRelyingPartyConfiguration());
+                    getMetadataProvider(), requestContext.getRelyingPartyConfiguration(), null);
         }
 
         queryContext.setAttributeRequester(requestContext.getAssertingPartyId());
@@ -798,7 +800,7 @@ public abstract class AbstractSAML1ProfileHandler extends AbstractSAMLProfileHan
      * @param <ResponseType> type of SAML 1 response
      * @param <ProfileConfigurationType> configuration type for this profile
      */
-    protected class SAML1ProfileRequestContext<RequestType extends SAMLObject, ResponseType extends ResponseAbstractType, ProfileConfigurationType extends AbstractSAML1ProfileConfiguration>
+    protected class SAML1ProfileRequestContext<RequestType extends RequestAbstractType, ResponseType extends ResponseAbstractType, ProfileConfigurationType extends AbstractSAML1ProfileConfiguration>
             extends SAMLProfileRequestContext {
 
         /** SAML request message. */
index 5c40f88..c21eab8 100644 (file)
@@ -29,6 +29,7 @@ import org.opensaml.common.binding.security.SAMLSecurityPolicy;
 import org.opensaml.saml1.binding.decoding.HTTPSOAP11Decoder;
 import org.opensaml.saml1.binding.encoding.HTTPSOAP11Encoder;
 import org.opensaml.saml1.core.AttributeQuery;
+import org.opensaml.saml1.core.Request;
 import org.opensaml.saml1.core.Response;
 import org.opensaml.saml1.core.Statement;
 import org.opensaml.saml1.core.StatusCode;
@@ -131,8 +132,9 @@ public class AttributeQueryProfileHandler extends AbstractSAML1ProfileHandler {
             SAMLSecurityPolicy securityPolicy = requestContext.getMessageDecoder().getSecurityPolicy();
             requestContext.setRelyingPartyId(securityPolicy.getIssuer());
 
-            AttributeQuery attributeQuery = (AttributeQuery) requestContext.getMessageDecoder().getSAMLMessage();
-            requestContext.setSamlRequest(attributeQuery);
+            Request request = (Request) requestContext.getMessageDecoder().getSAMLMessage();
+            requestContext.setSamlRequest(request);
+            requestContext.setAttributeQuery(request.getAttributeQuery());
 
             populateRelyingPartyData(requestContext);
 
@@ -249,7 +251,9 @@ public class AttributeQueryProfileHandler extends AbstractSAML1ProfileHandler {
 
     /** Basic data structure used to accumulate information as a request is being processed. */
     protected class AttributeQueryContext extends
-            SAML1ProfileRequestContext<AttributeQuery, Response, AttributeQueryConfiguration> {
+            SAML1ProfileRequestContext<Request, Response, AttributeQueryConfiguration> {
+        
+        private AttributeQuery attributeQuery;
 
         /**
          * Constructor.
@@ -260,5 +264,13 @@ public class AttributeQueryProfileHandler extends AbstractSAML1ProfileHandler {
         public AttributeQueryContext(ProfileRequest<ServletRequest> request, ProfileResponse<ServletResponse> response) {
             super(request, response);
         }
+        
+        public AttributeQuery getAttributeQuery(){
+            return attributeQuery;
+        }
+        
+        public void setAttributeQuery(AttributeQuery query){
+            attributeQuery = query;
+        }
     }
 }
\ No newline at end of file
index 339c409..2873418 100644 (file)
@@ -30,12 +30,12 @@ import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
 import org.apache.log4j.Logger;
-import org.opensaml.common.SAMLObject;
 import org.opensaml.common.SAMLObjectBuilder;
 import org.opensaml.common.binding.BasicEndpointSelector;
 import org.opensaml.common.binding.BindingException;
 import org.opensaml.common.binding.encoding.MessageEncoder;
 import org.opensaml.saml1.core.AuthenticationStatement;
+import org.opensaml.saml1.core.Request;
 import org.opensaml.saml1.core.Response;
 import org.opensaml.saml1.core.Statement;
 import org.opensaml.saml1.core.StatusCode;
@@ -433,7 +433,7 @@ public class ShibbolethSSOProfileHandler extends AbstractSAML1ProfileHandler {
 
     /** Represents the internal state of a Shibboleth SSO Request while it's being processed by the IdP. */
     protected class ShibbolethSSORequestContext extends
-            SAML1ProfileRequestContext<SAMLObject, Response, ShibbolethSSOConfiguration> {
+            SAML1ProfileRequestContext<Request, Response, ShibbolethSSOConfiguration> {
 
         /** Current login context. */
         private ShibbolethSSOLoginContext loginContext;
index bc5b0ce..e723d35 100644 (file)
@@ -539,14 +539,9 @@ public abstract class AbstractSAML2ProfileHandler extends AbstractSAMLProfileHan
             SAML2ProfileRequestContext requestContext) {
 
         ShibbolethSAMLAttributeRequestContext<NameID, AttributeQuery> queryContext;
-        if (requestContext.getSamlRequest() instanceof AttributeQuery) {
-            queryContext = new ShibbolethSAMLAttributeRequestContext<NameID, AttributeQuery>(getMetadataProvider(),
-                    requestContext.getRelyingPartyConfiguration(), (AttributeQuery) requestContext.getSamlRequest());
-        } else {
-            queryContext = new ShibbolethSAMLAttributeRequestContext<NameID, AttributeQuery>(getMetadataProvider(),
-                    requestContext.getRelyingPartyConfiguration());
-        }
-
+        
+        queryContext = new ShibbolethSAMLAttributeRequestContext<NameID, AttributeQuery>(getMetadataProvider(),
+                requestContext.getRelyingPartyConfiguration(), (AttributeQuery) requestContext.getSamlRequest());
         queryContext.setAttributeRequester(requestContext.getAssertingPartyId());
         queryContext.setPrincipalName(requestContext.getPrincipalName());
         queryContext.setProfileConfiguration(requestContext.getProfileConfiguration());