Class SAML2Response
java.lang.Object
org.keycloak.saml.processing.api.saml.v2.response.SAML2Response
API for dealing with SAML2 Response objects
- Since:
- Jan 5, 2009
- Author:
- Anil.Saldhana@redhat.com
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvert
(EncryptedElementType encryptedElementType) Convert an EncryptedElement into a Documentstatic Document
convert
(StatusResponseType responseType) Convert a SAML2 Response into a DocumentcreateAssertion
(String id, NameIDType issuer) Create an assertioncreateAuthnStatement
(String authnContextDeclRef, XMLGregorianCalendar issueInstant) Create an AuthnStatementcreateAuthzDecisionStatementType
(String resource, DecisionType decision, EvidenceType evidence, ActionType... actions) Create an Authorization Decision Statement TypeCreate an empty response typecreateResponseType
(String ID, IssuerInfoHolder issuerInfo, AssertionType assertion) Create a ResponseTypecreateResponseType
(String ID, IssuerInfoHolder issuerInfo, Element encryptedAssertion) Create a ResponseTypecreateResponseType
(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)
void
createTimedConditions
(AssertionType assertion, long durationInMilis) Add validity conditions to the SAML2 AssertionRead an assertion from an input streamGet an encrypted assertion from the streamRead a ResponseType from an input streamstatic SAMLDocumentHolder
getSAML2ObjectFromDocument
(Document samlDocument) Get the Underlying SAML2Object from a documentRead aSAML2Object
from an input streamGet the parsedSAMLDocumentHolder
void
marshall
(ResponseType responseType, OutputStream os) Marshall the response type to the output streamvoid
marshall
(ResponseType responseType, Writer writer) Marshall the ResponseType into a writer
-
Constructor Details
-
SAML2Response
public SAML2Response()
-
-
Method Details
-
createAssertion
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_TRANSPORTissueInstant
-- 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) throws 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 responsesp
- holder with the information about the Service Provideridp
- holder with the information on the Identity ProviderissuerInfo
- holder with information on the issuer- Returns:
- Throws:
ConfigurationException
ProcessingException
-
createResponseType
Create an empty response type- Returns:
-
createResponseType
public ResponseType createResponseType(String ID, IssuerInfoHolder issuerInfo, AssertionType assertion) 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 DOMElement
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
Get the parsedSAMLDocumentHolder
- 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 aSAML2Object
from an input stream- Parameters:
is
-- Returns:
- Throws:
ParsingException
ConfigurationException
ProcessingException
-
getSAML2ObjectFromDocument
public static SAMLDocumentHolder getSAML2ObjectFromDocument(Document samlDocument) throws ProcessingException, ParsingException Get the Underlying SAML2Object from a document- Parameters:
samlDocument
- a Document containing a SAML2Object- Returns:
- a SAMLDocumentHolder
- Throws:
ProcessingException
ParsingException
-
convert
Convert an EncryptedElement into a Document- Parameters:
encryptedElementType
-- Returns:
- Throws:
ConfigurationException
-
convert
public static Document convert(StatusResponseType responseType) throws ProcessingException, ConfigurationException, ParsingException Convert a SAML2 Response into a Document- Parameters:
responseType
-- Returns:
- Throws:
ParsingException
ConfigurationException
ProcessingException
-
marshall
Marshall the response type to the output stream- Parameters:
responseType
-os
-- Throws:
ProcessingException
-
marshall
Marshall the ResponseType into a writer- Parameters:
responseType
-writer
-- Throws:
ProcessingException
-