Only create assertions if there is a one or more statements within the response
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 25 Feb 2008 17:54:49 +0000 (17:54 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 25 Feb 2008 17:54:49 +0000 (17:54 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2651 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/idp/profile/saml1/AbstractSAML1ProfileHandler.java

index 70c9cc8..49c9a35 100644 (file)
@@ -231,21 +231,19 @@ public abstract class AbstractSAML1ProfileHandler extends AbstractSAMLProfileHan
 
         DateTime issueInstant = new DateTime();
 
-        // create the assertion and add the attribute statement
-        Assertion assertion = buildAssertion(requestContext, issueInstant);
-        if (statements != null && !statements.isEmpty()) {
-            assertion.getStatements().addAll(statements);
-        }
-
         // create the SAML response and add the assertion
         Response samlResponse = responseBuilder.buildObject();
         samlResponse.setIssueInstant(issueInstant);
         populateStatusResponse(requestContext, samlResponse);
 
-        samlResponse.getAssertions().add(assertion);
-
-        // sign the assertion if it should be signed
-        signAssertion(requestContext, assertion);
+        // create the assertion and add the attribute statement
+        Assertion assertion = null;
+        if (statements != null && !statements.isEmpty()) {
+            assertion = buildAssertion(requestContext, issueInstant);
+            assertion.getStatements().addAll(statements);
+            samlResponse.getAssertions().add(assertion);
+            signAssertion(requestContext, assertion);
+        }        
 
         Status status = buildStatus(StatusCode.SUCCESS, null, null);
         samlResponse.setStatus(status);