use of uk.gov.ida.saml.msa.test.domain.MatchingServiceAssertion in project verify-hub by alphagov.
the class MatchingServiceAssertionToAssertionTransformer method transform.
public Assertion transform(MatchingServiceAssertion originalAssertion) {
Assertion transformedAssertion = openSamlXmlObjectFactory.createAssertion();
transformedAssertion.setIssueInstant(originalAssertion.getIssueInstant());
Issuer transformedIssuer = openSamlXmlObjectFactory.createIssuer(originalAssertion.getIssuerId());
transformedAssertion.setIssuer(transformedIssuer);
transformedAssertion.setID(originalAssertion.getId());
Subject subject = outboundAssertionToSubjectTransformer.transform(originalAssertion);
transformedAssertion.setSubject(subject);
MatchingServiceAuthnStatement authnStatement = originalAssertion.getAuthnStatement();
transformedAssertion.getAuthnStatements().add(matchingServiceAuthnStatementToAuthnStatementTransformer.transform(authnStatement));
Conditions conditions = openSamlXmlObjectFactory.createConditions();
AudienceRestriction audienceRestriction = openSamlXmlObjectFactory.createAudienceRestriction(originalAssertion.getAudience());
conditions.getAudienceRestrictions().add(audienceRestriction);
transformedAssertion.setConditions(conditions);
List<Attribute> userAttributesForAccountCreation = originalAssertion.getUserAttributesForAccountCreation();
if (!userAttributesForAccountCreation.isEmpty()) {
addAttributes(transformedAssertion, userAttributesForAccountCreation);
}
return transformedAssertion;
}
Aggregations