Search in sources :

Example 1 with XmlObjectToBase64EncodedStringTransformer

use of uk.gov.ida.saml.serializers.XmlObjectToBase64EncodedStringTransformer in project verify-hub by alphagov.

the class AttributeQueryRequestBuilder method build.

public AttributeQueryRequestDto build(String persistentIdName, String matchingDatasetAssertionId, String authnStatementAssertionId, String requestId) {
    XmlObjectToBase64EncodedStringTransformer<XMLObject> toBase64EncodedStringTransformer = new XmlObjectToBase64EncodedStringTransformer<>();
    final PersistentId persistentId = aPersistentId().withNameId(persistentIdName).buildSamlEnginePersistentId();
    Assertion authnStatementAssertion = AssertionBuilder.anAssertion().withId(authnStatementAssertionId).buildUnencrypted();
    String authnStatementAssertionString = toBase64EncodedStringTransformer.apply(authnStatementAssertion);
    EncryptedAssertion encryptedMdsAssertion = AssertionBuilder.anAssertion().withId(matchingDatasetAssertionId).build();
    String encryptedMdsAssertionString = toBase64EncodedStringTransformer.apply(encryptedMdsAssertion);
    return aHubMatchingServiceRequestDto().withId(requestId).withMatchingServiceEntityId(TestEntityIds.TEST_RP_MS).withPersistentId(persistentId).withEncryptedMatchingDatasetAssertion(encryptedMdsAssertionString).withAuthnStatementAssertion(authnStatementAssertionString).build();
}
Also used : EncryptedAssertion(org.opensaml.saml.saml2.core.EncryptedAssertion) EncryptedAssertion(org.opensaml.saml.saml2.core.EncryptedAssertion) Assertion(org.opensaml.saml.saml2.core.Assertion) XMLObject(org.opensaml.core.xml.XMLObject) XmlObjectToBase64EncodedStringTransformer(uk.gov.ida.saml.serializers.XmlObjectToBase64EncodedStringTransformer) PersistentId(uk.gov.ida.hub.samlengine.domain.PersistentId) PersistentIdBuilder.aPersistentId(uk.gov.ida.hub.samlengine.builders.PersistentIdBuilder.aPersistentId)

Example 2 with XmlObjectToBase64EncodedStringTransformer

use of uk.gov.ida.saml.serializers.XmlObjectToBase64EncodedStringTransformer in project verify-hub by alphagov.

the class CountryAuthnResponseTranslatorResourceTest method assertEquals.

private void assertEquals(Assertion first, Assertion second) {
    XmlObjectToBase64EncodedStringTransformer serializer = new XmlObjectToBase64EncodedStringTransformer();
    assertThat(serializer.apply(first)).isEqualTo(serializer.apply(second));
}
Also used : XmlObjectToBase64EncodedStringTransformer(uk.gov.ida.saml.serializers.XmlObjectToBase64EncodedStringTransformer)

Example 3 with XmlObjectToBase64EncodedStringTransformer

use of uk.gov.ida.saml.serializers.XmlObjectToBase64EncodedStringTransformer in project verify-hub by alphagov.

the class EidasAttributeQueryRequestBuilder method build.

public EidasAttributeQueryRequestDto build() {
    XmlObjectToBase64EncodedStringTransformer<XMLObject> toBase64EncodedStringTransformer = new XmlObjectToBase64EncodedStringTransformer<>();
    EncryptedAssertion encryptedIdentityAssertion = AssertionBuilder.anAssertion().withId(UUID.randomUUID().toString()).build();
    String encryptedIdentityAssertionString = toBase64EncodedStringTransformer.apply(encryptedIdentityAssertion);
    return anEidasAttributeQueryRequestDto().withEncryptedIdentityAssertion(encryptedIdentityAssertionString).build();
}
Also used : EncryptedAssertion(org.opensaml.saml.saml2.core.EncryptedAssertion) XMLObject(org.opensaml.core.xml.XMLObject) XmlObjectToBase64EncodedStringTransformer(uk.gov.ida.saml.serializers.XmlObjectToBase64EncodedStringTransformer)

Aggregations

XmlObjectToBase64EncodedStringTransformer (uk.gov.ida.saml.serializers.XmlObjectToBase64EncodedStringTransformer)3 XMLObject (org.opensaml.core.xml.XMLObject)2 EncryptedAssertion (org.opensaml.saml.saml2.core.EncryptedAssertion)2 Assertion (org.opensaml.saml.saml2.core.Assertion)1 PersistentIdBuilder.aPersistentId (uk.gov.ida.hub.samlengine.builders.PersistentIdBuilder.aPersistentId)1 PersistentId (uk.gov.ida.hub.samlengine.domain.PersistentId)1