public class SSOUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addDeflateSignatureToHTTPQueryString(StringBuilder httpQueryString,
org.opensaml.security.x509.X509Credential credential)
Applies the XML Digital Signature to the HTTP query string specified.
|
static Optional<String> |
constructApplicationServerURL(org.apache.catalina.connector.Request request)
Returns an application server URL constructed using the specified request.
|
static String |
createID()
Generates a unique id.
|
static org.opensaml.saml.saml2.core.Assertion |
decryptAssertion(SSOX509Credential ssoAgentX509Credential,
org.opensaml.saml.saml2.core.EncryptedAssertion encryptedAssertion)
Returns a decrypted SAML 2.0
Assertion from the specified SAML 2.0 encrypted Assertion. |
static void |
doBootstrap()
Initializes the OpenSAML library modules, if not initialized yet.
|
static String |
encodeRequestMessage(org.opensaml.saml.saml2.core.RequestAbstractType requestMessage,
String binding)
Encodes the SAML 2.0 based request XML object into its corresponding Base64 notation, based on the type of
SAML 2.0 binding.
|
static Optional<String> |
generateConsumerURL(String contextPath,
String acsBase,
String acsPostfix)
Returns a SAML 2.0 Assertion Consumer URL based on service provider application context path.
|
static Optional<String> |
generateIssuerID(String contextPath,
String hostAppBase)
Returns a unique id value for the SAML 2.0 service provider application based on its context path.
|
static Optional |
generateKeyStore()
Returns a
KeyStore based on keystore properties specified. |
static Map<String,Object> |
generateRelayState(org.apache.catalina.connector.Request request)
Returns a map of SAML 2.0 Relay State content in the form of key-value pairs.
|
static Map<String,String> |
getAssertionStatements(org.opensaml.saml.saml2.core.Assertion assertion)
Returns the SAML 2.0 Assertion Attribute Statement content.
|
static Map<String,String[]> |
getSplitQueryParameters(String queryParameterString)
Returns the query parameters split out of the query parameter string.
|
static String |
marshall(org.opensaml.core.xml.XMLObject xmlObject)
Serializes the specified SAML 2.0 based XML content representation to its corresponding actual XML syntax
representation.
|
static void |
sendCharacterData(javax.servlet.http.HttpServletResponse response,
String htmlPayload)
Sends character data specified by the
htmlPayload in the servlet response body. |
static org.opensaml.saml.saml2.core.RequestAbstractType |
setSignature(org.opensaml.saml.saml2.core.RequestAbstractType request,
String signatureAlgorithm,
org.opensaml.security.x509.X509Credential credential)
Applies the XML Digital Signature to the SAML 2.0 based Request.
|
static Optional<org.opensaml.core.xml.XMLObject> |
unmarshall(String xmlString)
Returns a SAML 2.0 based XML content representation from the string value representing the XML syntax.
|
public static String createID()
public static Optional<String> constructApplicationServerURL(org.apache.catalina.connector.Request request)
request - the HTTP servlet requestpublic static Map<String,String[]> getSplitQueryParameters(String queryParameterString)
queryParameterString - the query parameter Stringpublic static Map<String,Object> generateRelayState(org.apache.catalina.connector.Request request)
request - the HTTP servlet requestpublic static Optional<String> generateIssuerID(String contextPath, String hostAppBase)
An optional id is returned based on the context path provided.
contextPath - the context path of the service provider applicationhostAppBase - the name of the Tomcat host's web application basepublic static Optional<String> generateConsumerURL(String contextPath, String acsBase, String acsPostfix)
An Optional String URL is returned based on the context path and configuration properties provided.
contextPath - the context path of the service provider applicationacsBase - the base URL of the Assertion Consumer ServiceacsPostfix - the postfix which identifies a SAML 2.0 Assertion Consumer URLpublic static Optional generateKeyStore() throws SSOException
KeyStore based on keystore properties specified.KeyStore instance generatedSSOException - if an error occurs while generating the KeyStore instancepublic static void sendCharacterData(javax.servlet.http.HttpServletResponse response,
String htmlPayload)
throws SSOException
htmlPayload in the servlet response body.response - the servlet response body in which character data are to be senthtmlPayload - the character data to be sent in the servlet bodySSOException - if an error occurs while writing character data to the servlet
response bodypublic static void doBootstrap()
throws SSOException
SSOException - if an error occurs when bootstrapping the OpenSAML2 librarypublic static org.opensaml.saml.saml2.core.RequestAbstractType setSignature(org.opensaml.saml.saml2.core.RequestAbstractType request,
String signatureAlgorithm,
org.opensaml.security.x509.X509Credential credential)
throws SSOException
request - the SAML 2.0 based RequestsignatureAlgorithm - the algorithm used to compute the signaturecredential - the signature signing credentialSSOException - if an error occurs while signing the SAML 2.0 based Request messagepublic static String encodeRequestMessage(org.opensaml.saml.saml2.core.RequestAbstractType requestMessage, String binding) throws SSOException
requestMessage - the RequestAbstractType XML object to be encodedbinding - the SAML 2.0 binding typeString corresponding to the request XML objectSSOException - if an error occurs while encoding SAML requestpublic static String marshall(org.opensaml.core.xml.XMLObject xmlObject) throws SSOException
xmlObject - the SAML 2.0 based XML content objectString representation of the actual XML representation of the SAML 2.0 based XML content
representationSSOException - if an error occurs during the marshalling processpublic static Optional<org.opensaml.core.xml.XMLObject> unmarshall(String xmlString) throws SSOException
xmlString - the String representation of the XML contentString value representing the XML syntaxSSOException - if an error occurs when unmarshalling the XML string representationpublic static org.opensaml.saml.saml2.core.Assertion decryptAssertion(SSOX509Credential ssoAgentX509Credential, org.opensaml.saml.saml2.core.EncryptedAssertion encryptedAssertion) throws SSOException
Assertion from the specified SAML 2.0 encrypted Assertion.ssoAgentX509Credential - credential for the resolverencryptedAssertion - the EncryptedAssertion instance to be decryptedAssertion from the specified SAML 2.0 EncryptedAssertionSSOException - if an error occurs during the decryption processpublic static Map<String,String> getAssertionStatements(org.opensaml.saml.saml2.core.Assertion assertion)
assertion - the SAML Assertion whose content is to be returnedpublic static void addDeflateSignatureToHTTPQueryString(StringBuilder httpQueryString, org.opensaml.security.x509.X509Credential credential) throws SSOException
httpQueryString - the primary HTTP query string which is to be digitally signedcredential - an entity credential associated with X.509 Public Key InfrastructureSSOException - if an error occurs while applying the SAML 2.0 Redirect binding signatureCopyright © 2016 WSO2. All rights reserved.