Revert last change and detect anonymous party earlier in the request processing
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 25 Feb 2008 13:31:48 +0000 (13:31 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 25 Feb 2008 13:31:48 +0000 (13:31 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2644 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/idp/profile/AbstractSAMLProfileHandler.java
src/edu/internet2/middleware/shibboleth/idp/profile/saml1/ShibbolethSSOProfileHandler.java
src/edu/internet2/middleware/shibboleth/idp/profile/saml2/SSOProfileHandler.java

index bd0c81a..075326a 100644 (file)
@@ -239,6 +239,21 @@ public abstract class AbstractSAMLProfileHandler extends
     public void setSupportedOutboundBindings(List<String> bindings) {
         supportedOutboundBindings = bindings;
     }
+    
+    /** {@inheritDoc} */
+    public RelyingPartyConfiguration getRelyingPartyConfiguration(String relyingPartyId) {
+        try{
+        if(getMetadataProvider().getEntityDescriptor(relyingPartyId) == null){
+            log.warn("No metadata for relying party {}, treating party as anonymous", relyingPartyId);
+            return getRelyingPartyConfigurationManager().getAnonymousRelyingConfiguration();
+        }
+        }catch(MetadataProviderException e){
+            log.error("Unable to look up relying party metadata", e);
+            return null;
+        }
+        
+        return super.getRelyingPartyConfiguration(relyingPartyId);
+    }
 
     /**
      * Populates the request context with information.
@@ -280,20 +295,13 @@ public abstract class AbstractSAMLProfileHandler extends
         EntityDescriptor relyingPartyMetadata;
         try {
             relyingPartyMetadata = metadataProvider.getEntityDescriptor(relyingPartyId);
+            requestContext.setPeerEntityMetadata(relyingPartyMetadata);
         } catch (MetadataProviderException e) {
             log.error("Error looking up metadata for relying party " + relyingPartyId, e);
             throw new ProfileException("Error looking up metadata for relying party " + relyingPartyId);
         }
 
-        RelyingPartyConfiguration rpConfig = null;
-        if (relyingPartyMetadata != null) {
-            requestContext.setPeerEntityMetadata(relyingPartyMetadata);
-            rpConfig = getRelyingPartyConfiguration(relyingPartyId);
-        } else {
-            log.warn("No metadata for relying party {}, treating party as anonymous", relyingPartyId);
-            rpConfig = getRelyingPartyConfigurationManager().getAnonymousRelyingConfiguration();
-        }
-
+        RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(relyingPartyId);
         if (rpConfig == null) {
             log.error("Unable to retrieve relying party configuration data for entity with ID {}", relyingPartyId);
             throw new ProfileException("Unable to retrieve relying party configuration data for entity with ID "
index 4fe837e..6de3f77 100644 (file)
@@ -204,7 +204,6 @@ public class ShibbolethSSOProfileHandler extends AbstractSAML1ProfileHandler {
             log.error("Shibboleth SSO request does not meet security requirements", e);
             throw new ProfileException("Shibboleth SSO request does not meet security requirements", e);
         }
-        populateRequestContext(requestContext);
         
         ShibbolethSSOLoginContext loginContext = new ShibbolethSSOLoginContext();
         loginContext.setRelyingParty(requestContext.getInboundMessageIssuer());
index fe810e8..87c8d88 100644 (file)
@@ -302,7 +302,6 @@ public class SSOProfileHandler extends AbstractSAML2ProfileHandler {
                 throw new ProfileException("Invalid SAML AuthnRequest message.");
             }
             
-            populateRequestContext(requestContext);
             return requestContext;
         } catch (MessageDecodingException e) {
             log.error("Error decoding authentication request message", e);