Class SAML2Request
- java.lang.Object
-
- org.keycloak.saml.processing.api.saml.v2.request.SAML2Request
-
public class SAML2Request extends Object
API for SAML2 Request- Since:
- Jan 5, 2009
- Author:
- Anil.Saldhana@redhat.com
-
-
Constructor Summary
Constructors Constructor Description SAML2Request()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Documentconvert(RequestAbstractType rat)Return the DOM objectstatic Documentconvert(ResponseType responseType)Convert a SAML2 Response into a DocumentAuthnRequestTypecreateAuthnRequestType(String id, String assertionConsumerURL, String destination, String issuerValue)Create authentication request with protocolBinding defaulting to POSTAuthnRequestTypecreateAuthnRequestType(String id, String assertionConsumerURL, String destination, String issuerValue, URI protocolBinding)Create an authentication requeststatic LogoutRequestTypecreateLogoutRequest(NameIDType issuer)Create a Logout RequestAuthnRequestTypegetAuthnRequestType(InputStream is)Get the AuthnRequestType from an input streamAuthnRequestTypegetAuthnRequestType(String fileName)Get AuthnRequestType from a fileRequestAbstractTypegetRequestType(InputStream is)Get a Request Type from Input Streamstatic SAMLDocumentHoldergetSAML2ObjectFromDocument(Document samlDocument)Get the Underlying SAML2Object from a documentstatic SAMLDocumentHoldergetSAML2ObjectFromStream(InputStream is)Get the Underlying SAML2Object from the input streamSAMLDocumentHoldergetSamlDocumentHolder()Get the parsedSAMLDocumentHolderstatic voidmarshall(RequestAbstractType requestType, OutputStream os)Marshall the AuthnRequestType to an output streamstatic voidmarshall(RequestAbstractType requestType, Writer writer)Marshall the AuthnRequestType to a writervoidsetNameIDFormat(String nameIDFormat)Set the NameIDFormat
-
-
-
Method Detail
-
setNameIDFormat
public void setNameIDFormat(String nameIDFormat)
Set the NameIDFormat- Parameters:
nameIDFormat-
-
createAuthnRequestType
public AuthnRequestType createAuthnRequestType(String id, String assertionConsumerURL, String destination, String issuerValue) throws ConfigurationException
Create authentication request with protocolBinding defaulting to POST- Parameters:
id-assertionConsumerURL-destination-issuerValue-- Returns:
- Throws:
ConfigurationException
-
createAuthnRequestType
public AuthnRequestType createAuthnRequestType(String id, String assertionConsumerURL, String destination, String issuerValue, URI protocolBinding) throws ConfigurationException
Create an authentication request- Parameters:
id-assertionConsumerURL-destination-issuerValue-protocolBindingUri-- Returns:
- Throws:
ConfigurationException
-
getAuthnRequestType
public AuthnRequestType getAuthnRequestType(String fileName) throws ConfigurationException, ProcessingException, ParsingException
Get AuthnRequestType from a file- Parameters:
fileName- file with the serialized AuthnRequestType- Returns:
- AuthnRequestType
- Throws:
ParsingExceptionProcessingExceptionConfigurationExceptionIllegalArgumentException- if the input fileName is null IllegalStateException if the InputStream from the fileName is null
-
getSAML2ObjectFromStream
public static SAMLDocumentHolder getSAML2ObjectFromStream(InputStream is) throws ConfigurationException, ParsingException, ProcessingException
Get the Underlying SAML2Object from the input stream- Parameters:
is-- Returns:
- Throws:
IOExceptionParsingExceptionConfigurationExceptionProcessingException
-
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:
ProcessingExceptionParsingException
-
getRequestType
public RequestAbstractType getRequestType(InputStream is) throws ParsingException, ConfigurationException, ProcessingException
Get a Request Type from Input Stream- Parameters:
is-- Returns:
- Throws:
ProcessingExceptionConfigurationExceptionIllegalArgumentException- inputstream is nullParsingException
-
getAuthnRequestType
public AuthnRequestType getAuthnRequestType(InputStream is) throws ConfigurationException, ProcessingException, ParsingException
Get the AuthnRequestType from an input stream- Parameters:
is- Inputstream containing the AuthnRequest- Returns:
- Throws:
ParsingExceptionProcessingExceptionConfigurationExceptionIllegalArgumentException- inputstream is null
-
getSamlDocumentHolder
public SAMLDocumentHolder getSamlDocumentHolder()
Get the parsedSAMLDocumentHolder- Returns:
-
createLogoutRequest
public static LogoutRequestType createLogoutRequest(NameIDType issuer) throws ConfigurationException
Create a Logout Request- Parameters:
issuer-- Returns:
- Throws:
ConfigurationException
-
convert
public static Document convert(RequestAbstractType rat) throws ProcessingException, ConfigurationException, ParsingException
Return the DOM object- Parameters:
rat-- Returns:
- Throws:
ProcessingExceptionParsingExceptionConfigurationException
-
convert
public static Document convert(ResponseType responseType) throws ProcessingException, ParsingException, ConfigurationException
Convert a SAML2 Response into a Document- Parameters:
responseType-- Returns:
- Throws:
ProcessingExceptionParsingExceptionConfigurationException
-
marshall
public static void marshall(RequestAbstractType requestType, OutputStream os) throws ProcessingException
Marshall the AuthnRequestType to an output stream- Parameters:
requestType-os-- Throws:
ProcessingException
-
marshall
public static void marshall(RequestAbstractType requestType, Writer writer) throws ProcessingException
Marshall the AuthnRequestType to a writer- Parameters:
requestType-writer-- Throws:
ProcessingException
-
-