java.lang.Object
org.codelibs.saml2.Auth
Main class of Java Toolkit.
This class implements the SP SAML instance.
Defines the methods that you can invoke in your application in
order to add SAML support (initiates sso, initiates slo, processes a
SAML Response, a Logout Request or a Logout Response).
This is stateful and not thread-safe, you should create a new instance for each request/response.
-
Constructor Summary
ConstructorsConstructorDescriptionAuth()Initializes the SP SAML instance.Auth(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.Initializes the SP SAML instance.Auth(String filename, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.Initializes the SP SAML instance.Auth(String filename, org.codelibs.saml2.core.model.KeyStoreSettings keyStoreSetting, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.Auth(org.codelibs.saml2.core.model.KeyStoreSettings keyStoreSetting) Initializes the SP SAML instance.Auth(org.codelibs.saml2.core.model.KeyStoreSettings keyStoreSetting, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.Auth(org.codelibs.saml2.core.settings.Saml2Settings settings, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance. -
Method Summary
Modifier and TypeMethodDescriptionbuildRequestSignature(String samlRequest, String relayState, String signAlgorithm) Generates the Signature for a SAML RequestbuildResponseSignature(String samlResponse, String relayState, String signAlgorithm) Generates the Signature for a SAML Responsefinal Collection<String> getAttribute(String name) Returns the issue instant of the last message processed.Returns the issue instant of the last request generated (AuthnRequest or LogoutRequest).Returns the most recently-constructed/processed XML SAML request (AuthNRequest, LogoutRequest)Returns the most recently-constructed/processed XML SAML response (SAMLResponse, LogoutResponse).final Stringfinal Stringfinal Stringfinal Stringfinal Instantfinal Stringorg.codelibs.saml2.core.settings.Saml2Settingsfinal booleanvoidlogin()Initiates the SSO process.voidInitiates the SSO process.voidDeprecated.login(String relayState, Boolean forceAuthn, Boolean isPassive, Boolean setNameIdPolicy, Boolean stay) Deprecated.uselogin(String, AuthnRequestParams, Boolean)withAuthnRequestParams(boolean, boolean, boolean)insteadlogin(String relayState, Boolean forceAuthn, Boolean isPassive, Boolean setNameIdPolicy, Boolean stay, String nameIdValueReq) Deprecated.uselogin(String, AuthnRequestParams, Boolean)withAuthnRequestParams(boolean, boolean, boolean, String)insteadlogin(String relayState, Boolean forceAuthn, Boolean isPassive, Boolean setNameIdPolicy, Boolean stay, String nameIdValueReq, Map<String, String> parameters) Deprecated.uselogin(String, AuthnRequestParams, Boolean, Map)withAuthnRequestParams(boolean, boolean, boolean, String)insteadvoidInitiates the SSO process.login(String relayState, org.codelibs.saml2.core.authn.AuthnRequestParams authnRequestParams, Boolean stay) Initiates the SSO process.login(String relayState, org.codelibs.saml2.core.authn.AuthnRequestParams authnRequestParams, Boolean stay, Map<String, String> parameters) Initiates the SSO process.voidlogin(org.codelibs.saml2.core.authn.AuthnRequestParams authnRequestParams) Initiates the SSO process.voidlogout()Initiates the SLO process.voidInitiates the SLO process.voidDeprecated.uselogout(String, LogoutRequestParams)withLogoutRequestParams(String, String)insteadDeprecated.uselogout(String, LogoutRequestParams, Boolean)withLogoutRequestParams(String, String)insteadDeprecated.uselogout(String, LogoutRequestParams, Boolean)withLogoutRequestParams(String, String, String)insteadlogout(String relayState, String nameId, String sessionIndex, Boolean stay, String nameidFormat, String nameIdNameQualifier) Deprecated.uselogout(String, LogoutRequestParams, Boolean)withLogoutRequestParams(String, String, String, String)insteadlogout(String relayState, String nameId, String sessionIndex, Boolean stay, String nameidFormat, String nameIdNameQualifier, String nameIdSPNameQualifier) Deprecated.uselogout(String, LogoutRequestParams, Boolean)withLogoutRequestParams(String, String, String, String, String)insteadlogout(String relayState, String nameId, String sessionIndex, Boolean stay, String nameidFormat, String nameIdNameQualifier, String nameIdSPNameQualifier, Map<String, String> parameters) Deprecated.uselogout(String, LogoutRequestParams, Boolean, Map)withLogoutRequestParams(String, String, String, String, String)insteadvoidDeprecated.uselogout(String, LogoutRequestParams)withLogoutRequestParams(String, String, String)insteadvoidlogout(String relayState, String nameId, String sessionIndex, String nameidFormat, String nameIdNameQualifier) Deprecated.uselogout(String, LogoutRequestParams)withLogoutRequestParams(String, String, String, String)insteadvoidlogout(String relayState, String nameId, String sessionIndex, String nameidFormat, String nameIdNameQualifier, String nameIdSPNameQualifier) Deprecated.uselogout(String, LogoutRequestParams)withLogoutRequestParams(String, String, String, String, String)insteadvoidInitiates the SLO process.logout(String relayState, org.codelibs.saml2.core.logout.LogoutRequestParams logoutRequestParams, Boolean stay) Initiates the SLO process.logout(String relayState, org.codelibs.saml2.core.logout.LogoutRequestParams logoutRequestParams, Boolean stay, Map<String, String> parameters) Initiates the SLO process.voidProcess the SAML Response sent by the IdP.voidprocessResponse(String requestId) Process the SAML Response sent by the IdP.voidProcess the SAML Logout Response / Logout Request sent by the IdP.voidprocessSLO(Boolean keepLocalSession, String requestId) Process the SAML Logout Response / Logout Request sent by the IdP.processSLO(Boolean keepLocalSession, String requestId, Boolean stay) Process the SAML Logout Response / Logout Request sent by the IdP.voidsetSamlMessageFactory(SamlMessageFactory samlMessageFactory) Sets the factory thisAuthwill use to create SAML messages.voidSet the strict mode active/disable
-
Constructor Details
-
Auth
public Auth()Initializes the SP SAML instance. -
Auth
public Auth(org.codelibs.saml2.core.model.KeyStoreSettings keyStoreSetting) Initializes the SP SAML instance.- Parameters:
keyStoreSetting- KeyStoreSettings is a KeyStore which have the Private/Public keys
-
Auth
Initializes the SP SAML instance.- Parameters:
filename- String Filename with the settings
-
Auth
Initializes the SP SAML instance.- Parameters:
filename- String Filename with the settingskeyStoreSetting- KeyStoreSettings is a KeyStore which have the Private/Public keys
-
Auth
public Auth(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.- Parameters:
request- HttpServletRequest object to be processedresponse- HttpServletResponse object to be used
-
Auth
public Auth(org.codelibs.saml2.core.model.KeyStoreSettings keyStoreSetting, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.- Parameters:
keyStoreSetting- KeyStoreSettings is a KeyStore which have the Private/Public keysrequest- HttpServletRequest object to be processedresponse- HttpServletResponse object to be used
-
Auth
public Auth(String filename, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.- Parameters:
filename- String Filename with the settingsrequest- HttpServletRequest object to be processedresponse- HttpServletResponse object to be used
-
Auth
public Auth(String filename, org.codelibs.saml2.core.model.KeyStoreSettings keyStoreSetting, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.- Parameters:
filename- String Filename with the settingskeyStoreSetting- KeyStoreSettings is a KeyStore which have the Private/Public keysrequest- HttpServletRequest object to be processedresponse- HttpServletResponse object to be used
-
Auth
public Auth(org.codelibs.saml2.core.settings.Saml2Settings settings, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Initializes the SP SAML instance.- Parameters:
settings- Saml2Settings object. Setting datarequest- HttpServletRequest object to be processedresponse- HttpServletResponse object to be used
-
-
Method Details
-
setStrict
Set the strict mode active/disable- Parameters:
value- Strict value
-
login
@Deprecated public String login(String relayState, Boolean forceAuthn, Boolean isPassive, Boolean setNameIdPolicy, Boolean stay, String nameIdValueReq) Deprecated.uselogin(String, AuthnRequestParams, Boolean)withAuthnRequestParams(boolean, boolean, boolean, String)insteadInitiates the SSO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the authenticated user should be redirected after the authentication response has been received back from the Identity Provider and validated correctly withprocessResponse(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedforceAuthn- When true the AuthNRequest will set the ForceAuthn='true'isPassive- When true the AuthNRequest will set the IsPassive='true'setNameIdPolicy- When true the AuthNRequest will set a nameIdPolicystay- True if we want to stay (returns the url string) False to execute redirectionnameIdValueReq- Indicates to the IdP the subject that should be authenticated- Returns:
- the SSO URL with the AuthNRequest if stay = True
-
login
@Deprecated public String login(String relayState, Boolean forceAuthn, Boolean isPassive, Boolean setNameIdPolicy, Boolean stay, String nameIdValueReq, Map<String, String> parameters) Deprecated.uselogin(String, AuthnRequestParams, Boolean, Map)withAuthnRequestParams(boolean, boolean, boolean, String)insteadInitiates the SSO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the authenticated user should be redirected after the authentication response has been received back from the Identity Provider and validated correctly withprocessResponse(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedforceAuthn- When true the AuthNRequest will set the ForceAuthn='true'isPassive- When true the AuthNRequest will set the IsPassive='true'setNameIdPolicy- When true the AuthNRequest will set a nameIdPolicystay- True if we want to stay (returns the url string) False to execute redirectionnameIdValueReq- Indicates to the IdP the subject that should be authenticatedparameters- Use it to send extra parameters in addition to the AuthNRequest- Returns:
- the SSO URL with the AuthNRequest if stay = True
-
login
@Deprecated public String login(String relayState, Boolean forceAuthn, Boolean isPassive, Boolean setNameIdPolicy, Boolean stay) Deprecated.uselogin(String, AuthnRequestParams, Boolean)withAuthnRequestParams(boolean, boolean, boolean)insteadInitiates the SSO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the authenticated user should be redirected after the authentication response has been received back from the Identity Provider and validated correctly withprocessResponse(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedforceAuthn- When true the AuthNRequest will set the ForceAuthn='true'isPassive- When true the AuthNRequest will set the IsPassive='true'setNameIdPolicy- When true the AuthNRequest will set a nameIdPolicystay- True if we want to stay (returns the url string) False to execute redirection- Returns:
- the SSO URL with the AuthNRequest if stay = True
-
login
@Deprecated public void login(String relayState, Boolean forceAuthn, Boolean isPassive, Boolean setNameIdPolicy) Deprecated.uselogin(String, AuthnRequestParams)withAuthnRequestParams(boolean, boolean, boolean)insteadInitiates the SSO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the authenticated user should be redirected after the authentication response has been received back from the Identity Provider and validated correctly withprocessResponse(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedforceAuthn- When true the AuthNRequest will set the ForceAuthn='true'isPassive- When true the AuthNRequest will set the IsPassive='true'setNameIdPolicy- When true the AuthNRequest will set a nameIdPolicy
-
login
public void login()Initiates the SSO process. -
login
public void login(org.codelibs.saml2.core.authn.AuthnRequestParams authnRequestParams) Initiates the SSO process.- Parameters:
authnRequestParams- the authentication request input parameters
-
login
Initiates the SSO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the authenticated user should be redirected after the authentication response has been received back from the Identity Provider and validated correctly withprocessResponse(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is provided
-
login
public void login(String relayState, org.codelibs.saml2.core.authn.AuthnRequestParams authnRequestParams) Initiates the SSO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the authenticated user should be redirected after the authentication response has been received back from the Identity Provider and validated correctly withprocessResponse(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedauthnRequestParams- the authentication request input parameters
-
login
public String login(String relayState, org.codelibs.saml2.core.authn.AuthnRequestParams authnRequestParams, Boolean stay) Initiates the SSO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the authenticated user should be redirected after the authentication response has been received back from the Identity Provider and validated correctly withprocessResponse(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedauthnRequestParams- the authentication request input parametersstay- True if we want to stay (returns the url string) False to execute redirection- Returns:
- the SSO URL with the AuthNRequest if stay = True
-
login
public String login(String relayState, org.codelibs.saml2.core.authn.AuthnRequestParams authnRequestParams, Boolean stay, Map<String, String> parameters) Initiates the SSO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the authenticated user should be redirected after the authentication response has been received back from the Identity Provider and validated correctly withprocessResponse(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedauthnRequestParams- the authentication request input parametersstay- True if we want to stay (returns the url string) False to execute redirectionparameters- Use it to send extra parameters in addition to the AuthNRequest- Returns:
- the SSO URL with the AuthNRequest if stay = True
-
logout
public String logout(String relayState, org.codelibs.saml2.core.logout.LogoutRequestParams logoutRequestParams, Boolean stay) Initiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedlogoutRequestParams- the logout request input parametersstay- True if we want to stay (returns the url string) False to execute redirection- Returns:
- the SLO URL with the LogoutRequest if stay = True
-
logout
public void logout(String relayState, org.codelibs.saml2.core.logout.LogoutRequestParams logoutRequestParams) Initiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedlogoutRequestParams- the logout request input parameters
-
logout
@Deprecated public String logout(String relayState, String nameId, String sessionIndex, Boolean stay, String nameidFormat, String nameIdNameQualifier, String nameIdSPNameQualifier) Deprecated.uselogout(String, LogoutRequestParams, Boolean)withLogoutRequestParams(String, String, String, String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).stay- True if we want to stay (returns the url string) False to execute redirectionnameidFormat- The NameID Format that will be set in the LogoutRequest.nameIdNameQualifier- The NameID NameQualifier that will be set in the LogoutRequest.nameIdSPNameQualifier- The NameID SP Name Qualifier that will be set in the LogoutRequest.- Returns:
- the SLO URL with the LogoutRequest if stay = True
-
logout
public String logout(String relayState, org.codelibs.saml2.core.logout.LogoutRequestParams logoutRequestParams, Boolean stay, Map<String, String> parameters) Initiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providedlogoutRequestParams- the logout request input parametersstay- True if we want to stay (returns the url string) False to execute redirectionparameters- Use it to send extra parameters in addition to the LogoutRequest- Returns:
- the SLO URL with the LogoutRequest if stay = True
-
logout
@Deprecated public String logout(String relayState, String nameId, String sessionIndex, Boolean stay, String nameidFormat, String nameIdNameQualifier, String nameIdSPNameQualifier, Map<String, String> parameters) Deprecated.uselogout(String, LogoutRequestParams, Boolean, Map)withLogoutRequestParams(String, String, String, String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).stay- True if we want to stay (returns the url string) False to execute redirectionnameidFormat- The NameID Format that will be set in the LogoutRequest.nameIdNameQualifier- The NameID NameQualifier that will be set in the LogoutRequest.nameIdSPNameQualifier- The NameID SP Name Qualifier that will be set in the LogoutRequest.parameters- Use it to send extra parameters in addition to the LogoutRequest- Returns:
- the SLO URL with the LogoutRequest if stay = True
-
logout
@Deprecated public String logout(String relayState, String nameId, String sessionIndex, Boolean stay, String nameidFormat, String nameIdNameQualifier) Deprecated.uselogout(String, LogoutRequestParams, Boolean)withLogoutRequestParams(String, String, String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).stay- True if we want to stay (returns the url string) False to execute redirectionnameidFormat- The NameID Format will be set in the LogoutRequest.nameIdNameQualifier- The NameID NameQualifier will be set in the LogoutRequest.- Returns:
- the SLO URL with the LogoutRequest if stay = True
-
logout
@Deprecated public String logout(String relayState, String nameId, String sessionIndex, Boolean stay, String nameidFormat) Deprecated.uselogout(String, LogoutRequestParams, Boolean)withLogoutRequestParams(String, String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).stay- True if we want to stay (returns the url string) False to execute redirectionnameidFormat- The NameID Format will be set in the LogoutRequest.- Returns:
- the SLO URL with the LogoutRequest if stay = True
-
logout
@Deprecated public String logout(String relayState, String nameId, String sessionIndex, Boolean stay) Deprecated.uselogout(String, LogoutRequestParams, Boolean)withLogoutRequestParams(String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).stay- True if we want to stay (returns the url string) False to execute redirection- Returns:
- the SLO URL with the LogoutRequest if stay = True
-
logout
@Deprecated public void logout(String relayState, String nameId, String sessionIndex, String nameidFormat, String nameIdNameQualifier, String nameIdSPNameQualifier) Deprecated.uselogout(String, LogoutRequestParams)withLogoutRequestParams(String, String, String, String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).nameidFormat- The NameID Format will be set in the LogoutRequest.nameIdNameQualifier- The NameID NameQualifier that will be set in the LogoutRequest.nameIdSPNameQualifier- The NameID SP Name Qualifier that will be set in the LogoutRequest.
-
logout
@Deprecated public void logout(String relayState, String nameId, String sessionIndex, String nameidFormat, String nameIdNameQualifier) Deprecated.uselogout(String, LogoutRequestParams)withLogoutRequestParams(String, String, String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).nameidFormat- The NameID Format will be set in the LogoutRequest.nameIdNameQualifier- The NameID NameQualifier will be set in the LogoutRequest.
-
logout
@Deprecated public void logout(String relayState, String nameId, String sessionIndex, String nameidFormat) Deprecated.uselogout(String, LogoutRequestParams)withLogoutRequestParams(String, String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).nameidFormat- The NameID Format will be set in the LogoutRequest.
-
logout
Deprecated.uselogout(String, LogoutRequestParams)withLogoutRequestParams(String, String)insteadInitiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is providednameId- The NameID that will be set in the LogoutRequest.sessionIndex- The SessionIndex (taken from the SAML Response in the SSO process).
-
logout
public void logout()Initiates the SLO process. -
logout
Initiates the SLO process.- Parameters:
relayState- a state information to pass forth and back between the Service Provider and the Identity Provider; in the most simple case, it may be a URL to which the logged out user should be redirected after the logout response has been received back from the Identity Provider and validated correctly withprocessSLO(); please note that SAML 2.0 specification imposes a limit of max 80 characters for this relayState data and that protection strategies against tampering should better be implemented; it will be a self-routed URL whennull, otherwise no relayState at all will be appended if an empty string is provided
-
getSSOurl
- Returns:
- The url of the Single Sign On Service
-
getSLOurl
- Returns:
- The url of the Single Logout Service
-
getSLOResponseUrl
- Returns:
- The url of the Single Logout Service Response.
-
processResponse
Process the SAML Response sent by the IdP.- Parameters:
requestId- The ID of the AuthNRequest sent by this SP to the IdP
-
processResponse
public void processResponse()Process the SAML Response sent by the IdP. -
processSLO
Process the SAML Logout Response / Logout Request sent by the IdP.- Parameters:
keepLocalSession- When true will keep the local session, otherwise will destroy itrequestId- The ID of the LogoutRequest sent by this SP to the IdPstay- True if we want to stay (returns the url string) False to execute redirection- Returns:
- the URL with the Logout Message if stay = True
-
processSLO
Process the SAML Logout Response / Logout Request sent by the IdP.- Parameters:
keepLocalSession- When true will keep the local session, otherwise will destroy itrequestId- The ID of the LogoutRequest sent by this SP to the IdP
-
processSLO
public void processSLO()Process the SAML Logout Response / Logout Request sent by the IdP. -
isAuthenticated
public final boolean isAuthenticated()- Returns:
- the authenticated
-
getAttributesName
- Returns:
- the list of the names of the SAML attributes.
-
getAttributes
- Returns:
- the set of SAML attributes.
-
getAttribute
- Parameters:
name- Name of the attribute- Returns:
- the attribute value
-
getNameId
- Returns:
- the nameID of the assertion
-
getNameIdFormat
- Returns:
- the nameID Format of the assertion
-
getNameIdNameQualifier
- Returns:
- the NameQualifier of the assertion
-
getNameIdSPNameQualifier
- Returns:
- the SPNameQualifier of the assertion
-
getSessionIndex
- Returns:
- the SessionIndex of the assertion
-
getSessionExpiration
- Returns:
- the SessionNotOnOrAfter of the assertion
-
getLastMessageId
- Returns:
- The ID of the last message processed
-
getLastMessageIssueInstant
Returns the issue instant of the last message processed.- Returns:
- The issue instant of the last message processed
-
getLastAssertionId
- Returns:
- The ID of the last assertion processed
-
getLastAssertionNotOnOrAfter
- Returns:
- The NotOnOrAfter values of the last assertion processed
-
getErrors
- Returns:
- an array with the errors, the array is empty when the validation was successful
-
getLastErrorReason
- Returns:
- the reason for the last error
-
getLastValidationException
- Returns:
- the exception for the last error
-
getLastRequestId
- Returns:
- the id of the last request generated (AuthnRequest or LogoutRequest), null if none
-
getLastRequestIssueInstant
Returns the issue instant of the last request generated (AuthnRequest or LogoutRequest).- Returns:
- the issue instant of the last request generated (AuthnRequest or LogoutRequest),
nullif none
-
getSettings
public org.codelibs.saml2.core.settings.Saml2Settings getSettings()- Returns:
- the Saml2Settings object. The Settings data.
-
isDebugActive
- Returns:
- if debug mode is active
-
buildRequestSignature
Generates the Signature for a SAML Request- Parameters:
samlRequest- The SAML RequestrelayState- The RelayStatesignAlgorithm- Signature algorithm method- Returns:
- a base64 encoded signature
-
buildResponseSignature
Generates the Signature for a SAML Response- Parameters:
samlResponse- The SAML ResponserelayState- The RelayStatesignAlgorithm- Signature algorithm method- Returns:
- the base64 encoded signature
-
getLastRequestXML
Returns the most recently-constructed/processed XML SAML request (AuthNRequest, LogoutRequest)- Returns:
- the last Request XML
-
getLastResponseXML
Returns the most recently-constructed/processed XML SAML response (SAMLResponse, LogoutResponse). If the SAMLResponse was encrypted, by default tries to return the decrypted XML.- Returns:
- the last Response XML
-
setSamlMessageFactory
Sets the factory thisAuthwill use to create SAML messages.This allows consumers to provide their own extension classes for SAML message XML generation and/or processing.
- Parameters:
samlMessageFactory- the factory to use to create SAML message objects; ifnull, a default provider will be used which creates the standard message implementation provided by this library (i.e.:AuthnRequest,SamlResponse,LogoutRequestandLogoutResponse)
-
login(String, AuthnRequestParams)withAuthnRequestParams(boolean, boolean, boolean)instead