Search in sources :

Example 6 with EncryptedAssertionType

use of org.keycloak.dom.saml.v2.assertion.EncryptedAssertionType in project keycloak by keycloak.

the class SAML2Response method getEncryptedAssertion.

/**
 * Get an encrypted assertion from the stream
 *
 * @param is
 *
 * @return
 *
 * @throws org.keycloak.saml.common.exceptions.ParsingException
 * @throws ProcessingException
 * @throws ConfigurationException
 */
public EncryptedAssertionType getEncryptedAssertion(InputStream is) throws ParsingException, ConfigurationException, ProcessingException {
    if (is == null)
        throw logger.nullArgumentError("InputStream");
    Document samlDocument = DocumentUtil.getDocument(is);
    SAMLParser samlParser = SAMLParser.getInstance();
    JAXPValidationUtil.checkSchemaValidation(samlDocument);
    return (EncryptedAssertionType) samlParser.parse(samlDocument);
}
Also used : SAMLParser(org.keycloak.saml.processing.core.parsers.saml.SAMLParser) EncryptedAssertionType(org.keycloak.dom.saml.v2.assertion.EncryptedAssertionType) Document(org.w3c.dom.Document)

Example 7 with EncryptedAssertionType

use of org.keycloak.dom.saml.v2.assertion.EncryptedAssertionType in project keycloak by keycloak.

the class SAMLParserTest method testSaml20EncryptedAssertion.

@Test
public void testSaml20EncryptedAssertion() throws Exception {
    EncryptedAssertionType ea = assertParsed("saml20-assertion-encrypted.xml", EncryptedAssertionType.class);
    assertThat(ea, notNullValue());
    assertThat(ea.getEncryptedElement(), notNullValue());
    assertThat(ea.getEncryptedElement().getLocalName(), is("EncryptedAssertion"));
}
Also used : EncryptedAssertionType(org.keycloak.dom.saml.v2.assertion.EncryptedAssertionType) Test(org.junit.Test)

Aggregations

EncryptedAssertionType (org.keycloak.dom.saml.v2.assertion.EncryptedAssertionType)7 ResponseType (org.keycloak.dom.saml.v2.protocol.ResponseType)4 Test (org.junit.Test)2 NameIDType (org.keycloak.dom.saml.v2.assertion.NameIDType)2 StatusResponseType (org.keycloak.dom.saml.v2.protocol.StatusResponseType)2 Element (org.w3c.dom.Element)2 QName (javax.xml.namespace.QName)1 AssertionType (org.keycloak.dom.saml.v2.assertion.AssertionType)1 ArtifactResponseType (org.keycloak.dom.saml.v2.protocol.ArtifactResponseType)1 ExtensionsType (org.keycloak.dom.saml.v2.protocol.ExtensionsType)1 RTChoiceType (org.keycloak.dom.saml.v2.protocol.ResponseType.RTChoiceType)1 StatusType (org.keycloak.dom.saml.v2.protocol.StatusType)1 ProcessingException (org.keycloak.saml.common.exceptions.ProcessingException)1 SAMLParser (org.keycloak.saml.processing.core.parsers.saml.SAMLParser)1 Document (org.w3c.dom.Document)1