Package com.onelogin.saml2.authn
Class AuthnRequest
- java.lang.Object
-
- com.onelogin.saml2.authn.AuthnRequest
-
public class AuthnRequest extends java.lang.ObjectAuthNRequest class of OneLogin's Java Toolkit. A class that implements SAML 2 Authentication Request
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringauthnRequestStringSAML AuthNRequest stringprivate java.lang.StringidSAML AuthNRequest ID.private java.util.CalendarissueInstantTime stamp that indicates when the AuthNRequest was createdprivate static org.slf4j.LoggerLOGGERPrivate property to construct a logger for this class.private Saml2SettingssettingsSettings data.
-
Constructor Summary
Constructors Constructor Description AuthnRequest(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, java.lang.String nameIdValueReq)Deprecated.AuthnRequest(Saml2Settings settings, AuthnRequestParams params)Constructs the AuthnRequest object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.apache.commons.lang3.text.StrSubstitutorgenerateSubstitutor(AuthnRequestParams params, Saml2Settings settings)Substitutes AuthnRequest variables within a string by values.private static java.lang.StringBuildergetAuthnRequestTemplate()java.lang.StringgetAuthnRequestXml()java.lang.StringgetEncodedAuthnRequest()java.lang.StringgetEncodedAuthnRequest(java.lang.Boolean deflated)java.lang.StringgetId()java.util.CalendargetIssueInstant()Returns the issue instant of this message.protected java.lang.StringpostProcessXml(java.lang.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 Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
Private property to construct a logger for this class.
-
authnRequestString
private final java.lang.String authnRequestString
SAML AuthNRequest string
-
id
private final java.lang.String id
SAML AuthNRequest ID.
-
settings
private final Saml2Settings settings
Settings data.
-
issueInstant
private final java.util.Calendar issueInstant
Time stamp that indicates when the AuthNRequest was created
-
-
Constructor Detail
-
AuthnRequest
public AuthnRequest(Saml2Settings settings)
Constructs the AuthnRequest object.- Parameters:
settings- OneLogin_Saml2_Settings- See Also:
AuthnRequest(Saml2Settings, AuthnRequestParams)
-
AuthnRequest
@Deprecated public AuthnRequest(Saml2Settings settings, boolean forceAuthn, boolean isPassive, boolean setNameIdPolicy, java.lang.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
public AuthnRequest(Saml2Settings settings, AuthnRequestParams params)
Constructs the AuthnRequest object.- Parameters:
settings- OneLogin_Saml2_Settingsparams- a set of authentication request input parameters that shape the request to create
-
-
Method Detail
-
postProcessXml
protected java.lang.String postProcessXml(java.lang.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
public java.lang.String getEncodedAuthnRequest(java.lang.Boolean deflated) throws java.io.IOException- Parameters:
deflated- If deflated or not the encoded AuthnRequest- Returns:
- the base64 encoded unsigned AuthnRequest (deflated or not)
- Throws:
java.io.IOException
-
getEncodedAuthnRequest
public java.lang.String getEncodedAuthnRequest() throws java.io.IOException- Returns:
- base64 encoded, unsigned AuthnRequest (deflated or not)
- Throws:
java.io.IOException
-
getAuthnRequestXml
public java.lang.String 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
private static java.lang.StringBuilder getAuthnRequestTemplate()
- Returns:
- the AuthnRequest's template
-
getId
public java.lang.String getId()
- Returns:
- the generated id of the AuthnRequest message
-
getIssueInstant
public java.util.Calendar getIssueInstant()
Returns the issue instant of this message.- Returns:
- a new
Calendarinstance carrying the issue instant of this message
-
-