public class IDPSSOUtil extends Object
Modifier and Type | Field and Description |
---|---|
static CircleOfTrustManager |
cotManager |
static SAML2MetaManager |
metaManager |
static String |
NAMEID_FORMAT |
static String |
NULL |
Modifier and Type | Method and Description |
---|---|
static void |
doSSOFederate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
PrintWriter out,
AuthnRequest authnReq,
String spEntityID,
String idpMetaAlias,
String nameIDFormat,
String relayState,
Object newSession,
SAML2EventLogger auditor)
Does SSO with existing federation or new federation
|
static void |
doSSOFederate(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
PrintWriter out,
AuthnRequest authnReq,
String spEntityID,
String idpMetaAlias,
String nameIDFormat,
String relayState,
SAML2EventLogger auditor)
Does SSO with existing federation or new federation
|
static String |
getACSurl(String spEntityID,
String realm,
AuthnRequest authnReq,
javax.servlet.http.HttpServletRequest request,
StringBuffer rBinding)
Returns the assertion consumer service
URL |
static String |
getACSurl(String spEntityID,
String realm,
String acsURL,
String binding,
Integer index,
javax.servlet.http.HttpServletRequest request,
StringBuffer rBinding)
Returns the assertion consumer service
URL . |
static String |
getACSurlFromMetaByBinding(String spEntityID,
String realm,
String desiredBinding,
StringBuffer returnedBinding)
Returns the assertion consumer service
URL from
meta data by binding |
static String |
getACSurlFromMetaByIndex(String spEntityID,
String realm,
int acsIndex,
StringBuffer returnedBinding)
Returns the assertion consumer service
URL from
meta data by binding |
static String |
getAttributeValueFromIDPSSOConfig(String realm,
String hostEntityId,
String attrName) |
static String |
getAuthenticationServiceURL(String realm,
String hostEntityId,
javax.servlet.http.HttpServletRequest request)
Returns the authentication service
URL of the
identity provider |
static String |
getBindingForAcsUrl(String spEntityID,
String realm,
String acsURL)
Returns the assertion consumer service url binding from
the metadata.
|
protected static Conditions |
getConditions(String audienceEntityID,
int notBeforeSkewTime,
int effectiveTime)
Returns a
SAML Conditions object |
static String |
getDefaultACSurl(String spEntityID,
String realm,
StringBuffer returnedBinding)
Returns the default assertion consumer service url and binding
from the metadata.
|
protected static int |
getEffectiveTime(String realm,
String idpEntityID)
Returns the effective time from the IDP
extended metadata .
|
static SAML2IdentityProviderAdapter |
getIDPAdapterClass(String realm,
String idpEntityID)
Returns a
SAML2IdentityProviderAdapter |
static IDPAuthnContextMapper |
getIDPAuthnContextMapper(String realm,
String idpEntityID)
Returns an
IDPAuthnContextMapper |
static IDPECPSessionMapper |
getIDPECPSessionMapper(String realm,
String idpEntityID)
Returns an
IDPECPSessionMapper |
protected static int |
getNotBeforeSkewTime(String realm,
String idpEntityID)
Returns the NotBefore skew time from the IDP
extended metadata .
|
static Response |
getResponse(javax.servlet.http.HttpServletRequest request,
Object session,
AuthnRequest authnReq,
String recipientEntityID,
String idpEntityID,
String idpMetaAlias,
String realm,
String nameIDFormat,
String acsURL,
String affiliationID,
AuthnContext matchingAuthnContext)
Returns a
SAML Response object. |
static String |
getSessionIndex(Object session)
Returns the session index of an
IDPSession |
static long |
getValidTimeofResponse(String realm,
String idpEntityID,
Response response) |
static boolean |
isValidSessionInRealm(String realm,
Object session)
Check that the authenticated session belongs to the same realm where the IDP is defined.
|
static void |
sendResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
PrintWriter out,
String cachedResID)
Sends a response to service provider
|
static void |
sendResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
PrintWriter out,
String acsBinding,
String spEntityID,
String idpEntityID,
String idpMetaAlias,
String realm,
String relayState,
String acsURL,
Response res,
Object session)
Sends a response to service provider
|
static void |
sendResponseArtifact(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String idpEntityID,
String spEntityID,
String realm,
String acsURL,
String relayState,
Response res,
Object session,
Map props)
This method opens a URL connection to the target specified and
sends artifact response to it using the
HttpServletResponse object. |
static void |
sendResponseECP(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
PrintWriter out,
String idpEntityID,
String realm,
String acsURL,
Response res)
This method sends SAML Response back to ECP.
|
static void |
sendResponseToACS(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
PrintWriter out,
Object session,
AuthnRequest authnReq,
String spEntityID,
String idpEntityID,
String idpMetaAlias,
String realm,
String nameIDFormat,
String relayState,
AuthnContext matchingAuthnContext)
Sends
Response containing an Assertion
back to the requesting service provider |
static void |
sendResponseWithStatus(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
PrintWriter out,
String idpMetaAlias,
String idpEntityID,
String realm,
AuthnRequest authnReq,
String relayState,
String spEntityID,
String firstlevelStatusCodeValue,
String secondlevelStatusCodeValue)
A convenience method to construct response with First-level and Second-level status code for
SAML authentication requests.
|
static byte[] |
stringToByteArray(String input) |
public static final String NAMEID_FORMAT
public static final String NULL
public static SAML2MetaManager metaManager
public static CircleOfTrustManager cotManager
public static void doSSOFederate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter out, AuthnRequest authnReq, String spEntityID, String idpMetaAlias, String nameIDFormat, String relayState, SAML2EventLogger auditor) throws SAML2Exception
request
- the HttpServletRequest
objectresponse
- the HttpServletResponse
objectout
- the print writer for writing out presentationauthnReq
- the AuthnRequest
objectspEntityID
- the entity id of the service provideridpMetaAlias
- the meta alias of the identity providernameIDFormat
- the NameIDFormat
relayState
- the relay stateauditor
- the auditor for logging SAML2 Events - may be nullSAML2Exception
- if the operation is not successfulpublic static void doSSOFederate(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter out, AuthnRequest authnReq, String spEntityID, String idpMetaAlias, String nameIDFormat, String relayState, Object newSession, SAML2EventLogger auditor) throws SAML2Exception
request
- the HttpServletRequest
objectresponse
- the HttpServletResponse
objectout
- the print writer for writing out presentationauthnReq
- the AuthnRequest
objectspEntityID
- the entity id of the service provideridpMetaAlias
- the meta alias of the identity providernameIDFormat
- the NameIDFormat
relayState
- the relay statenewSession
- Session used in IDP Proxy Caseauditor
- the auditor for logging SAML2 EventsSAML2Exception
- if the operation is not successfulpublic static void sendResponseToACS(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter out, Object session, AuthnRequest authnReq, String spEntityID, String idpEntityID, String idpMetaAlias, String realm, String nameIDFormat, String relayState, AuthnContext matchingAuthnContext) throws SAML2Exception
Response
containing an Assertion
back to the requesting service providerrequest
- the HttpServletRequest
objectresponse
- the HttpServletResponse
objectout
- the print writer for writing out presentationsession
- user sessionauthnReq
- the AuthnRequest
objectspEntityID
- the entity id of the service provideridpEntityID
- the entity id of the identity provideridpMetaAlias
- the meta alias of the identity providerrealm
- the realmnameIDFormat
- the NameIDFormat
relayState
- the relay statematchingAuthnContext
- the AuthnContext
used to find
authentication type and scheme.SAML2Exception
public static void sendResponseWithStatus(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter out, String idpMetaAlias, String idpEntityID, String realm, AuthnRequest authnReq, String relayState, String spEntityID, String firstlevelStatusCodeValue, String secondlevelStatusCodeValue) throws SAML2Exception
request
- The servlet request.response
- The servlet response.out
- The print writer for writing out presentation.idpMetaAlias
- The IdP's metaAlias.idpEntityID
- The IdP's entity ID.realm
- The realm where the IdP belongs to.authnReq
- The SAML AuthnRequest sent by the SP.relayState
- The RelayState value.spEntityID
- The SP's entity ID.firstlevelStatusCodeValue
- First-level status code value passed.secondlevelStatusCodeValue
- Second-level status code value passed.SAML2Exception
- If there was an error while creating or sending the response back to the SP.public static void sendResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter out, String cachedResID) throws SAML2Exception
request
- The servlet request.response
- The servlet response.out
- The print writer for writing out presentation.cachedResID
- the key used to retrieve response information
from the response information cacheSAML2Exception
- if the operation is not successfulpublic static void sendResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter out, String acsBinding, String spEntityID, String idpEntityID, String idpMetaAlias, String realm, String relayState, String acsURL, Response res, Object session) throws SAML2Exception
response
- the HttpServletResponse
objectacsBinding
- the assertion consumer service bindingspEntityID
- the entity id of the service provideridpEntityID
- the entity id of the identity provideridpMetaAlias
- the meta alias of the identity providerrealm
- the realm namerelayState
- the relay stateacsURL
- the assertion consumer service url
res
- the SAML Response
objectSAML2Exception
- if the operation is not successfulpublic static Response getResponse(javax.servlet.http.HttpServletRequest request, Object session, AuthnRequest authnReq, String recipientEntityID, String idpEntityID, String idpMetaAlias, String realm, String nameIDFormat, String acsURL, String affiliationID, AuthnContext matchingAuthnContext) throws SAML2Exception
SAML Response
object.request
- The HTTP request.session
- The user's session object.authnReq
- The AuthnRequest
object.recipientEntityID
- The entity ID of the response recipient.idpEntityID
- The entity ID of the identity provider.realm
- The realm name.nameIDFormat
- The NameIDFormat
.acsURL
- The ACS
service url
.affiliationID
- AffiliationID for IDP initiated SSO.matchingAuthnContext
- the AuthnContext
used to find authentication type and scheme.SAML Response
object.SAML2Exception
- if the operation is not successful.public static IDPAuthnContextMapper getIDPAuthnContextMapper(String realm, String idpEntityID) throws SAML2Exception
IDPAuthnContextMapper
realm
- the realm nameidpEntityID
- the entity id of the identity providerIDPAuthnContextMapper
SAML2Exception
- if the operation is not successfulpublic static IDPECPSessionMapper getIDPECPSessionMapper(String realm, String idpEntityID) throws SAML2Exception
IDPECPSessionMapper
realm
- the realm nameidpEntityID
- the entity id of the identity providerIDPECPSessionMapper
SAML2Exception
- if the operation is not successfulprotected static Conditions getConditions(String audienceEntityID, int notBeforeSkewTime, int effectiveTime) throws SAML2Exception
SAML Conditions
objectaudienceEntityID
- the entity id of the audienceeffectiveTime
- the effective time of the assertionSAML Conditions
objectSAML2Exception
- if the operation is not successfulpublic static String getACSurl(String spEntityID, String realm, AuthnRequest authnReq, javax.servlet.http.HttpServletRequest request, StringBuffer rBinding) throws SAML2Exception
URL
spEntityID
- the entity id of the service providerrealm
- the realm name of the identity providerauthnReq
- the AuthnRequest
objectrequest
- the HttpServletRequest
objectrBinding
- the binding used to send back Response
URL
SAML2Exception
- if the operation is not successfulpublic static String getACSurl(String spEntityID, String realm, String acsURL, String binding, Integer index, javax.servlet.http.HttpServletRequest request, StringBuffer rBinding) throws SAML2Exception
URL
.spEntityID
- The entity id of the service provider.realm
- The realm name of the identity provider.acsURL
- AssertionConsumerServiceURL in AuthnRequest.binding
- ProtocolBinding in AuthnRequest.index
- AssertionConsumerServiceIndex in AuthnRequest.request
- The HttpServletRequest
object.rBinding
- The binding used to send back Response
.URL
.SAML2Exception
- if the operation is not successful.public static String getDefaultACSurl(String spEntityID, String realm, StringBuffer returnedBinding) throws SAML2Exception
spEntityID
- the entity id of the service providerrealm
- the realm name of the identity providerSAML2Exception
- if the operation is not successfulpublic static String getBindingForAcsUrl(String spEntityID, String realm, String acsURL) throws SAML2Exception
spEntityID
- the entity id of the service providerrealm
- the realm name of the identity providerSAML2Exception
- if the operation is not successfulpublic static String getACSurlFromMetaByBinding(String spEntityID, String realm, String desiredBinding, StringBuffer returnedBinding) throws SAML2Exception
URL
from
meta data by bindingspEntityID
- the entity id of the service providerrealm
- the realm name of the identity providerdesiredBinding
- the desired bindingreturnedBinding
- the binding used to send back
Response
URL
SAML2Exception
- if the operation is not successfulpublic static String getACSurlFromMetaByIndex(String spEntityID, String realm, int acsIndex, StringBuffer returnedBinding) throws SAML2Exception
URL
from
meta data by bindingspEntityID
- the entity id of the service providerrealm
- the realm name of the identity provideracsIndex
- the ACS
indexreturnedBinding
- the binding used to send back
Response
URL
SAML2Exception
- if the operation is not successfulpublic static void sendResponseArtifact(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String idpEntityID, String spEntityID, String realm, String acsURL, String relayState, Response res, Object session, Map props) throws SAML2Exception
HttpServletResponse
object.response
- the HttpServletResponse
objectidpEntityID
- the entity id of the identity providerrealm
- the realm name of the identity provideracsURL
- the assertion consumer service URL
relayState
- the value of the RelayState
res
- the SAML Response
objectsession
- user sessionprops
- property map including nameIDString for loggingSAML2Exception
- if the operation is not successfulpublic static void sendResponseECP(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter out, String idpEntityID, String realm, String acsURL, Response res) throws SAML2Exception
request
- The servlet request.response
- The servlet response.out
- The print writer for writing out presentation.idpEntityID
- the entity id of the identity providerrealm
- the realm name of the identity provideracsURL
- the assertion consumer service URL
res
- the SAML Response
objectSAML2Exception
- if the operation is not successfulpublic static String getSessionIndex(Object session)
IDPSession
session
- the session corresponding to the IDPSession
public static String getAuthenticationServiceURL(String realm, String hostEntityId, javax.servlet.http.HttpServletRequest request)
URL
of the
identity providerrealm
- the realm name of the identity providerhostEntityId
- the entity id of the identity providerrequest
- the HttpServletRequest
objectURL
of the
identity providerpublic static String getAttributeValueFromIDPSSOConfig(String realm, String hostEntityId, String attrName)
protected static int getEffectiveTime(String realm, String idpEntityID)
protected static int getNotBeforeSkewTime(String realm, String idpEntityID)
public static byte[] stringToByteArray(String input)
public static long getValidTimeofResponse(String realm, String idpEntityID, Response response) throws SAML2Exception
SAML2Exception
public static SAML2IdentityProviderAdapter getIDPAdapterClass(String realm, String idpEntityID) throws SAML2Exception
SAML2IdentityProviderAdapter
realm
- the realm nameidpEntityID
- the entity id of the identity providerSAML2IdenityProviderAdapter
SAML2Exception
- if the operation is not successfulpublic static boolean isValidSessionInRealm(String realm, Object session)
realm
- The realm where the IdP is defined.session
- The Session object of the authenticated user.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.