Package com.onelogin.saml2.authn
Class AuthnRequest
java.lang.Object
com.onelogin.saml2.authn.AuthnRequest
AuthNRequest class of OneLogin's Java Toolkit.
A class that implements SAML 2 Authentication Request
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringSAML AuthNRequest stringprivate final StringSAML AuthNRequest ID.private final CalendarTime stamp that indicates when the AuthNRequest was createdprivate static final org.slf4j.LoggerPrivate property to construct a logger for this class.private final Saml2SettingsSettings data. -
Constructor Summary
ConstructorsConstructorDescriptionAuthnRequest(Saml2Settings settings) Constructs the AuthnRequest object.AuthnRequest(Saml2Settings settings, boolean forceAuthn, boolean isPassive, boolean setNameIdPolicy) Deprecated.AuthnRequest(Saml2Settings settings, boolean forceAuthn, boolean isPassive, boolean setNameIdPolicy, String nameIdValueReq) Deprecated.AuthnRequest(Saml2Settings settings, AuthnRequestParams params) Constructs the AuthnRequest object. -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.commons.lang3.text.StrSubstitutorgenerateSubstitutor(AuthnRequestParams params, Saml2Settings settings) Substitutes AuthnRequest variables within a string by values.private static StringBuildergetEncodedAuthnRequest(Boolean deflated) getId()Returns the issue instant of this message.protected StringpostProcessXml(String authnRequestXml, AuthnRequestParams params, Saml2Settings settings) Allows for an extension class to post-process the AuthnRequest XML generated for this request, in order to customize the result.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGERPrivate property to construct a logger for this class. -
authnRequestString
SAML AuthNRequest string -
id
SAML AuthNRequest ID. -
settings
Settings data. -
issueInstant
Time stamp that indicates when the AuthNRequest was created
-
-
Constructor Details
-
AuthnRequest
Constructs the AuthnRequest object.- Parameters:
settings- OneLogin_Saml2_Settings- See Also:
-
AuthnRequest
@Deprecated public AuthnRequest(Saml2Settings settings, boolean forceAuthn, boolean isPassive, boolean setNameIdPolicy, String nameIdValueReq) Deprecated.Constructs the AuthnRequest object.- Parameters:
settings- OneLogin_Saml2_SettingsforceAuthn- When true the AuthNReuqest will set the ForceAuthn='true'isPassive- When true the AuthNReuqest will set the IsPassive='true'setNameIdPolicy- When true the AuthNReuqest will set a nameIdPolicynameIdValueReq- Indicates to the IdP the subject that should be authenticated
-
AuthnRequest
@Deprecated public AuthnRequest(Saml2Settings settings, boolean forceAuthn, boolean isPassive, boolean setNameIdPolicy) Deprecated.Constructs the AuthnRequest object.- Parameters:
settings- OneLogin_Saml2_SettingsforceAuthn- When true the AuthNReuqest will set the ForceAuthn='true'isPassive- When true the AuthNReuqest will set the IsPassive='true'setNameIdPolicy- When true the AuthNReuqest will set a nameIdPolicy
-
AuthnRequest
Constructs the AuthnRequest object.- Parameters:
settings- OneLogin_Saml2_Settingsparams- a set of authentication request input parameters that shape the request to create
-
-
Method Details
-
postProcessXml
protected String postProcessXml(String authnRequestXml, AuthnRequestParams params, Saml2Settings settings) Allows for an extension class to post-process the AuthnRequest XML generated for this request, in order to customize the result.This method is invoked at construction time, after all the other fields of this class have already been initialised. Its default implementation simply returns the input XML as-is, with no change.
- Parameters:
authnRequestXml- the XML produced for this AuthnRequest by the standard implementation provided byAuthnRequestparams- the authentication request input parameterssettings- the settings- Returns:
- the post-processed XML for this AuthnRequest, which will then be
returned by any call to
getAuthnRequestXml()
-
getEncodedAuthnRequest
- Parameters:
deflated- If deflated or not the encoded AuthnRequest- Returns:
- the base64 encoded unsigned AuthnRequest (deflated or not)
- Throws:
IOException
-
getEncodedAuthnRequest
- Returns:
- base64 encoded, unsigned AuthnRequest (deflated or not)
- Throws:
IOException
-
getAuthnRequestXml
- Returns:
- unsigned plain-text AuthnRequest.
-
generateSubstitutor
private org.apache.commons.lang3.text.StrSubstitutor generateSubstitutor(AuthnRequestParams params, Saml2Settings settings) Substitutes AuthnRequest variables within a string by values.- Parameters:
params- the authentication request input parameterssettings- Saml2Settings object. Setting data- Returns:
- the StrSubstitutor object of the AuthnRequest
-
getAuthnRequestTemplate
- Returns:
- the AuthnRequest's template
-
getId
- Returns:
- the generated id of the AuthnRequest message
-
getIssueInstant
Returns the issue instant of this message.- Returns:
- a new
Calendarinstance carrying the issue instant of this message
-
AuthnRequest(Saml2Settings, AuthnRequestParams)withAuthnRequestParams(boolean, boolean, boolean)instead