[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/profile/BaseIdpIn...

noreply at shibboleth.net noreply at shibboleth.net
Fri Jun 7 21:38:58 EDT 2013


Author: putmanb
Date: Fri Jun  7 21:38:57 2013
New Revision: 4527

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4527&view=rev
Log:
Refactor and flesh out the Shibboleth protocol IdP-initiated message decoders.
Add missing unit tests for same.

Added:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/IdpInitatedSsoRequest.java
      - copied, changed from r4526, trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/IdpInitatedSsoRequest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/IdpInitiatedSsoRequestMessageDecoderTest.java   (with props)
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/IdpInitiatedSsoRequestMessageDecoderTest.java   (with props)
Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/BaseIdpInitiatedSsoRequestMessageDecoder.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/IdpInitatedSsoRequest.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml1/IdpInitiatedSsoRequestMessageDecoder.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/IdpInitiatedSsoRequestMessageDecoder.java
    trunk/idp-saml-impl/src/test/resources/logback-test.xml

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/BaseIdpInitiatedSsoRequestMessageDecoder.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/BaseIdpInitiatedSsoRequestMessageDecoder.java?rev=4527&r1=4526&r2=4527&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/BaseIdpInitiatedSsoRequestMessageDecoder.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/BaseIdpInitiatedSsoRequestMessageDecoder.java Fri Jun  7 21:38:57 2013
@@ -21,9 +21,13 @@
 import javax.servlet.http.HttpServletRequest;
 
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
+import net.shibboleth.utilities.java.support.security.IdentifierGenerationStrategy;
+import net.shibboleth.utilities.java.support.security.Type4UuidIdentifierGenerationStrategy;
 
 import org.opensaml.messaging.decoder.MessageDecodingException;
 import org.opensaml.messaging.decoder.servlet.AbstractHttpServletRequestMessageDecoder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Decodes an incoming Shibboleth Authentication Request message.
@@ -33,7 +37,7 @@
 @NotThreadSafe
 public abstract class BaseIdpInitiatedSsoRequestMessageDecoder<RequestType> extends
         AbstractHttpServletRequestMessageDecoder<RequestType> {
-
+    
     /**
      * Deprecated name of the query parameter carrying the service provider entity ID: {@value} . Use of
      * {@link #ENTITY_ID_PARAM} is preferred.
@@ -60,6 +64,38 @@
 
     /** Name of the query parameter carrying the current time at the service provider: {@value. } */
     public static final String TIME_PARAM = "time";
+    
+    /** Class logger. */
+    private final Logger log = LoggerFactory.getLogger(BaseIdpInitiatedSsoRequestMessageDecoder.class);
+    
+    /** Used to log protocol messages. */
+    private final Logger protocolMessageLog = LoggerFactory.getLogger("PROTOCOL_MESSAGE");
+    
+    /** ID generator. */
+    private final IdentifierGenerationStrategy idGenerator = new Type4UuidIdentifierGenerationStrategy();
+    
+    /** {@inheritDoc} */
+    public void decode() throws MessageDecodingException {
+        log.debug("Beginning to decode message from HttpServletRequest");
+        
+        super.decode();
+        
+        logDecodedMessage();
+
+        log.debug("Successfully decoded message from HttpServletRequest.");
+    }
+    
+    /**
+     * Build a new IdP-initiated request structure from the inbound HTTP request.
+     * 
+     * @return the new SSO request structure
+     * @throws MessageDecodingException if the request doesn't contain an entityID
+     */
+    protected IdpInitatedSsoRequest buildIdpInitiatedSsoRequest() throws MessageDecodingException {
+        final HttpServletRequest request = getHttpServletRequest();
+        return new IdpInitatedSsoRequest(getEntityId(request), getAcsUrl(request),
+                        getTarget(request), getTime(request)); 
+    }
 
     /**
      * Gets the entity ID of the service provider.
@@ -70,7 +106,7 @@
      * 
      * @throws MessageDecodingException thrown if the request does not contain a service provider entity ID
      */
-    public String getEntityId(HttpServletRequest request) throws MessageDecodingException {
+    protected String getEntityId(HttpServletRequest request) throws MessageDecodingException {
         String entityId = StringSupport.trimOrNull(request.getParameter(ENTITY_ID_PARAM));
         if (entityId == null) {
             entityId = StringSupport.trimOrNull(request.getParameter(PROVIDER_ID_PARAM));

[... 399 lines stripped ...]


More information about the commits mailing list