Add 2 post-processing methods, so subclasses get a chance to process Assertions and...
authorputmanb <putmanb@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 18 Jun 2009 05:44:05 +0000 (05:44 +0000)
committerputmanb <putmanb@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 18 Jun 2009 05:44:05 +0000 (05:44 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/branches/REL_2@2848 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml2/AbstractSAML2ProfileHandler.java

index 52a32ea..738614c 100644 (file)
@@ -260,6 +260,8 @@ public abstract class AbstractSAML2ProfileHandler extends AbstractSAMLProfileHan
             assertion = buildAssertion(requestContext, issueInstant);
             assertion.getStatements().addAll(statements);
             assertion.setSubject(buildSubject(requestContext, subjectConfirmationMethod, issueInstant));
+            
+            postProcessAssertion(requestContext, assertion);
 
             signAssertion(requestContext, assertion);
 
@@ -296,11 +298,37 @@ public abstract class AbstractSAML2ProfileHandler extends AbstractSAMLProfileHan
 
         Status status = buildStatus(StatusCode.SUCCESS_URI, null, null);
         samlResponse.setStatus(status);
+        
+        postProcessResponse(requestContext, samlResponse);
 
         return samlResponse;
     }
 
     /**
+     * Extension point for for subclasses to post-process the Response before it is signed and encoded.
+     * 
+     * @param requestContext the current request context
+     * @param samlResponse the SAML Response being built
+     * 
+     * @throws ProfileException if there was an error processing the response
+     */
+    protected void postProcessResponse(BaseSAML2ProfileRequestContext<?, ?, ?> requestContext, Response samlResponse) 
+            throws ProfileException {
+    }
+
+    /**
+     * Extension point for for subclasses to post-process the Assertion before it is signed and encrypted.
+     * 
+     * @param requestContext the current request context
+     * @param assertion the SAML Assertion being built
+     * 
+     * @throws ProfileException if there is an error processing the assertion
+     */
+    protected void postProcessAssertion(BaseSAML2ProfileRequestContext<?, ?, ?> requestContext, Assertion assertion) 
+            throws ProfileException {
+    }
+
+    /**
      * Builds a basic assertion with its id, issue instant, SAML version, issuer, subject, and conditions populated.
      * 
      * @param requestContext current request context