org.keycloak.saml.processing.api.saml.v2.response

## Class SAML2Response

- java.lang.Object
- - org.keycloak.saml.processing.api.saml.v2.response.SAML2Response

-     public class SAML2Response
      extends Object

  API for dealing with SAML2 Response objects
  Since:
    Jan 5, 2009
  Author:
    Anil.Saldhana@redhat.com

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SAML2Response()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Document` | `convert(EncryptedElementType encryptedElementType)` Convert an EncryptedElement into a Document
    `Document` | `convert(StatusResponseType responseType)` Convert a SAML2 Response into a Document
    `AssertionType` | `createAssertion(String id, NameIDType issuer)` Create an assertion
    `AuthnStatementType` | `createAuthnStatement(String authnContextDeclRef, XMLGregorianCalendar issueInstant)` Create an AuthnStatement
    `AuthzDecisionStatementType` | `createAuthzDecisionStatementType(String resource, DecisionType decision, EvidenceType evidence, ActionType... actions)` Create an Authorization Decision Statement Type
    `ResponseType` | `createResponseType(String ID)` Create an empty response type
    `ResponseType` | `createResponseType(String ID, IssuerInfoHolder issuerInfo, AssertionType assertion)` Create a ResponseType
    `ResponseType` | `createResponseType(String ID, IssuerInfoHolder issuerInfo, Element encryptedAssertion)` Create a ResponseType
    `ResponseType` | `createResponseType(String ID, SPInfoHolder sp, IDPInfoHolder idp, IssuerInfoHolder issuerInfo)` Create a ResponseType NOTE:: The PicketLink STS is used to issue/update the assertion If you want to control over the assertion being issued, then use `createResponseType(String, SPInfoHolder, IDPInfoHolder, IssuerInfoHolder, AssertionType)`
    `ResponseType` | `createResponseType(String ID, SPInfoHolder sp, IDPInfoHolder idp, IssuerInfoHolder issuerInfo, AssertionType assertion)` Construct a `ResponseType` without calling PicketLink STS for the assertion.
    `void` | `createTimedConditions(AssertionType assertion, long durationInMilis)` Add validity conditions to the SAML2 Assertion
    `AssertionType` | `getAssertionType(InputStream is)` Read an assertion from an input stream
    `EncryptedAssertionType` | `getEncryptedAssertion(InputStream is)` Get an encrypted assertion from the stream
    `ResponseType` | `getResponseType(InputStream is)` Read a ResponseType from an input stream
    `SAML2Object` | `getSAML2ObjectFromStream(InputStream is)` Read a `SAML2Object` from an input stream
    `SAMLDocumentHolder` | `getSamlDocumentHolder()` Get the parsed `SAMLDocumentHolder`
    `void` | `marshall(ResponseType responseType, OutputStream os)` Marshall the response type to the output stream
    `void` | `marshall(ResponseType responseType, Writer writer)` Marshall the ResponseType into a writer

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SAML2Response

          public SAML2Response()

  - ### Method Detail

    - #### createAssertion

          public AssertionType createAssertion(String id,
                                               NameIDType issuer)

      Create an assertion
      Parameters:
        `id` -
        `issuer` -
      Returns:

    - #### createAuthnStatement

          public AuthnStatementType createAuthnStatement(String authnContextDeclRef,
                                                         XMLGregorianCalendar issueInstant)

      Create an AuthnStatement
      Parameters:
        `authnContextDeclRef` - such as JBossSAMLURIConstants.AC_PASSWORD_PROTECTED_TRANSPORT
        `issueInstant` -
      Returns:

    - #### createAuthzDecisionStatementType

          public AuthzDecisionStatementType createAuthzDecisionStatementType(String resource,
                                                                             DecisionType decision,
                                                                             EvidenceType evidence,
                                                                             ActionType... actions)

      Create an Authorization Decision Statement Type
      Parameters:
        `resource` -
        `decision` -
        `evidence` -
        `actions` -
      Returns:

    - #### createResponseType

          public ResponseType createResponseType(String ID,
                                                 SPInfoHolder sp,
                                                 IDPInfoHolder idp,
                                                 IssuerInfoHolder issuerInfo,
                                                 AssertionType assertion)
                                          throws ConfigurationException,
                                                 ProcessingException

      Construct a `ResponseType` without calling PicketLink STS for the assertion. The `AssertionType` is generated within this method
      Parameters:
        `ID` - id of the `ResponseType`
        `sp` -
        `idp` -
        `issuerInfo` -
      Returns:
      Throws:
        `ConfigurationException`
        `ProcessingException`

    - #### createResponseType

          public ResponseType createResponseType(String ID,
                                                 SPInfoHolder sp,
                                                 IDPInfoHolder idp,
                                                 IssuerInfoHolder issuerInfo)
                                          throws ConfigurationException,
                                                 ProcessingException

      Create a ResponseType NOTE:: The PicketLink STS is used to issue/update the assertion If you want to control over the assertion being issued, then use `createResponseType(String, SPInfoHolder, IDPInfoHolder, IssuerInfoHolder, AssertionType)`
      Parameters:
        `ID` - id of the response
        `sp` - holder with the information about the Service Provider
        `idp` - holder with the information on the Identity Provider
        `issuerInfo` - holder with information on the issuer
      Returns:
      Throws:
        `ConfigurationException`
        `ProcessingException`

    - #### createResponseType

          public ResponseType createResponseType(String ID)

      Create an empty response type
      Returns:

    - #### createResponseType

          public ResponseType createResponseType(String ID,
                                                 IssuerInfoHolder issuerInfo,
                                                 AssertionType assertion)
                                          throws ConfigurationException

      Create a ResponseType
      Parameters:
        `ID` -
        `issuerInfo` -
        `assertion` -
      Returns:
      Throws:
        `ConfigurationException`

    - #### createResponseType

          public ResponseType createResponseType(String ID,
                                                 IssuerInfoHolder issuerInfo,
                                                 Element encryptedAssertion)
                                          throws ConfigurationException

      Create a ResponseType
      Parameters:
        `ID` -
        `issuerInfo` -
        `encryptedAssertion` - a DOM `Element` that represents an encrypted assertion
      Returns:
      Throws:
        `ConfigurationException`

    - #### createTimedConditions

          public void createTimedConditions(AssertionType assertion,
                                            long durationInMilis)
                                     throws ConfigurationException,
                                            IssueInstantMissingException

      Add validity conditions to the SAML2 Assertion
      Parameters:
        `assertion` -
        `durationInMilis` -
      Throws:
        `ConfigurationException`
        `IssueInstantMissingException`

    - #### getEncryptedAssertion

          public EncryptedAssertionType getEncryptedAssertion(InputStream is)
                                                       throws ParsingException,
                                                              ConfigurationException,
                                                              ProcessingException

      Get an encrypted assertion from the stream
      Parameters:
        `is` -
      Returns:
      Throws:
        `ParsingException`
        `ProcessingException`
        `ConfigurationException`

    - #### getAssertionType

          public AssertionType getAssertionType(InputStream is)
                                         throws ParsingException,
                                                ConfigurationException,
                                                ProcessingException

      Read an assertion from an input stream
      Parameters:
        `is` -
      Returns:
      Throws:
        `ParsingException`
        `ProcessingException`
        `ConfigurationException`

    - #### getSamlDocumentHolder

          public SAMLDocumentHolder getSamlDocumentHolder()

      Get the parsed `SAMLDocumentHolder`
      Returns:

    - #### getResponseType

          public ResponseType getResponseType(InputStream is)
                                       throws ParsingException,
                                              ConfigurationException,
                                              ProcessingException

      Read a ResponseType from an input stream
      Parameters:
        `is` -
      Returns:
      Throws:
        `ParsingException`
        `ConfigurationException`
        `ProcessingException`

    - #### getSAML2ObjectFromStream

          public SAML2Object getSAML2ObjectFromStream(InputStream is)
                                               throws ParsingException,
                                                      ConfigurationException,
                                                      ProcessingException

      Read a `SAML2Object` from an input stream
      Parameters:
        `is` -
      Returns:
      Throws:
        `ParsingException`
        `ConfigurationException`
        `ProcessingException`

    - #### convert

          public Document convert(EncryptedElementType encryptedElementType)
                           throws ConfigurationException

      Convert an EncryptedElement into a Document
      Parameters:
        `encryptedElementType` -
      Returns:
      Throws:
        `ConfigurationException`

    - #### convert

          public Document convert(StatusResponseType responseType)
                           throws ProcessingException,
                                  ConfigurationException,
                                  ParsingException

      Convert a SAML2 Response into a Document
      Parameters:
        `responseType` -
      Returns:
      Throws:
        `ParsingException`
        `ConfigurationException`
        `ProcessingException`

    - #### marshall

          public void marshall(ResponseType responseType,
                               OutputStream os)
                        throws ProcessingException

      Marshall the response type to the output stream
      Parameters:
        `responseType` -
        `os` -
      Throws:
        `ProcessingException`

    - #### marshall

          public void marshall(ResponseType responseType,
                               Writer writer)
                        throws ProcessingException

      Marshall the ResponseType into a writer
      Parameters:
        `responseType` -
        `writer` -
      Throws:
        `ProcessingException`

Copyright © 2016 JBoss by Red Hat. All rights reserved.