Package org.pac4j.core.client
Class IndirectClient
java.lang.Object
org.pac4j.core.util.InitializableObject
org.pac4j.core.client.BaseClient
org.pac4j.core.client.IndirectClient
- All Implemented Interfaces:
Client
Indirect client: the requested protected URL is saved, the user is redirected to the identity provider for login and
back to the application after the sucessful authentication and finally to the originally requested URL.
- Since:
- 1.9.0
- Author:
- Jerome Leleu
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected Stringprotected CallbackUrlResolverprotected UrlResolverFields inherited from class org.pac4j.core.client.BaseClient
logger, saveProfileInSession -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidafterInternalInit(boolean forceReinit) protected voidbeforeInternalInit(boolean forceReinit) computeFinalCallbackUrl(WebContext context) protected voiddefaultLogoutActionBuilder(LogoutActionBuilder logoutActionBuilder) protected voiddefaultRedirectionActionBuilder(RedirectionActionBuilder redirectActionBuilder) final Optional<Credentials>getCredentials(WebContext context, SessionStore sessionStore) Get the credentials from the web context.final Optional<RedirectionAction>getLogoutAction(WebContext context, SessionStore sessionStore, UserProfile currentProfile, String targetUrl) Return the logout action (indirect clients).final Optional<RedirectionAction>getRedirectionAction(WebContext context, SessionStore sessionStore) If an authentication has already been tried for this client and has failed (nullcredentials) or if the request is an AJAX one, an unauthorized response is thrown instead of a "redirection".booleanprotected CallbackUrlResolvervoidsetAjaxRequestResolver(AjaxRequestResolver ajaxRequestResolver) voidsetCallbackUrl(String callbackUrl) voidsetCallbackUrlResolver(CallbackUrlResolver callbackUrlResolver) voidsetCheckAuthenticationAttempt(boolean checkAuthenticationAttempt) voidsetLogoutActionBuilder(LogoutActionBuilder logoutActionBuilder) voidsetRedirectionActionBuilder(RedirectionActionBuilder redirectionActionBuilder) voidsetUrlResolver(UrlResolver urlResolver) toString()Methods inherited from class org.pac4j.core.client.BaseClient
addAuthorizationGenerator, addAuthorizationGenerators, defaultAuthenticator, defaultCredentialsExtractor, defaultProfileCreator, getAuthenticator, getAuthorizationGenerators, getCredentialsExtractor, getCustomProperties, getName, getProfileCreator, getProfileFactoryWhenNotAuthenticated, getSaveProfileInSession, getUserProfile, isMultiProfile, notifySessionRenewal, renewUserProfile, retrieveCredentials, retrieveUserProfile, setAuthenticator, setAuthorizationGenerator, setAuthorizationGenerators, setAuthorizationGenerators, setCredentialsExtractor, setCustomProperties, setMultiProfile, setName, setProfileCreator, setProfileFactoryWhenNotAuthenticated, setSaveProfileInSessionMethods inherited from class org.pac4j.core.util.InitializableObject
getLastAttempt, getMaxAttempts, getMinTimeIntervalBetweenAttemptsInMilliseconds, getNbAttempts, init, init, internalInit, isInitialized, reinit, setMaxAttempts, setMinTimeIntervalBetweenAttemptsInMilliseconds, shouldInitialize
-
Field Details
-
ATTEMPTED_AUTHENTICATION_SUFFIX
- See Also:
-
callbackUrl
-
urlResolver
-
callbackUrlResolver
-
-
Constructor Details
-
IndirectClient
public IndirectClient()
-
-
Method Details
-
beforeInternalInit
protected void beforeInternalInit(boolean forceReinit) - Overrides:
beforeInternalInitin classInitializableObject
-
afterInternalInit
protected final void afterInternalInit(boolean forceReinit) - Overrides:
afterInternalInitin classInitializableObject
-
newDefaultCallbackUrlResolver
-
getRedirectionAction
public final Optional<RedirectionAction> getRedirectionAction(WebContext context, SessionStore sessionStore) If an authentication has already been tried for this client and has failed (
nullcredentials) or if the request is an AJAX one, an unauthorized response is thrown instead of a "redirection".- Parameters:
context- contextsessionStore- the session store- Returns:
- the "redirection" action
-
getCredentials
Get the credentials from the web context. In some cases, a
HttpActionmay be thrown:- if the
CasClientreceives a logout request, it returns a 200 HTTP status code - for the
IndirectBasicAuthClient, if no credentials are sent to the callback url, an unauthorized response (401 HTTP status code) is returned to request credentials through a popup.
- Parameters:
context- the current web contextsessionStore- the session store- Returns:
- the credentials
- if the
-
getLogoutAction
public final Optional<RedirectionAction> getLogoutAction(WebContext context, SessionStore sessionStore, UserProfile currentProfile, String targetUrl) Description copied from interface:ClientReturn the logout action (indirect clients).
- Parameters:
context- the current web contextsessionStore- the session storecurrentProfile- the currentProfiletargetUrl- the target url after logout- Returns:
- the redirection to perform (optional)
-
computeFinalCallbackUrl
-
setCallbackUrl
-
getCallbackUrl
-
getUrlResolver
-
setUrlResolver
-
getCallbackUrlResolver
-
setCallbackUrlResolver
-
getAjaxRequestResolver
-
setAjaxRequestResolver
-
getRedirectionActionBuilder
-
defaultRedirectionActionBuilder
-
getLogoutActionBuilder
-
defaultLogoutActionBuilder
-
setRedirectionActionBuilder
-
setLogoutActionBuilder
-
getStateSessionAttributeName
-
getNonceSessionAttributeName
-
getCodeVerifierSessionAttributeName
-
isCheckAuthenticationAttempt
public boolean isCheckAuthenticationAttempt() -
setCheckAuthenticationAttempt
public void setCheckAuthenticationAttempt(boolean checkAuthenticationAttempt) -
toString
- Overrides:
toStringin classBaseClient
-