public class BasicAuthClient extends AbstractHeaderClient<UsernamePasswordCredentials>
This class is the client to authenticate users through HTTP basic auth.
For authentication, the user is redirected to the callback url. If the user is not authenticated by basic auth, a
specific exception : RequiresHttpAction
is returned which must be handled by the application to force
authentication.
The realm name can be defined using the AbstractHeaderClient.setRealmName(String)
method.
It returns a HttpProfile
.
HttpProfile
ATTEMPTED_AUTHENTICATION_SUFFIX, callbackUrl, logger, NEEDS_CLIENT_REDIRECTION_PARAMETER
Constructor and Description |
---|
BasicAuthClient() |
BasicAuthClient(UsernamePasswordAuthenticator usernamePasswordAuthenticator) |
BasicAuthClient(UsernamePasswordAuthenticator usernamePasswordAuthenticator,
UsernameProfileCreator profilePopulator) |
Modifier and Type | Method and Description |
---|---|
Mechanism |
getMechanism() |
protected void |
internalInit() |
protected BasicAuthClient |
newClient() |
protected UsernamePasswordCredentials |
retrieveCredentialsFromHeader(String header) |
protected RedirectAction |
retrieveRedirectAction(WebContext context) |
String |
toString() |
getHeaderName, getPrefixHeader, getRealmName, isDirectRedirection, retrieveCredentials, setHeaderName, setPrefixHeader, setRealmName
retrieveUserProfile
addAuthorizationGenerator, clone, getAuthenticator, getAuthorizationGenerators, getCallbackUrl, getContextualCallbackUrl, getCredentials, getName, getProfileCreator, getRedirectAction, getRedirectionUrl, getStateParameter, getUserProfile, isEnableContextualRedirects, prependHostToUrlIfNotPresent, redirect, setAuthenticator, setAuthorizationGenerator, setAuthorizationGenerators, setCallbackUrl, setEnableContextualRedirects, setName, setProfileCreator
init, reinit
public BasicAuthClient()
public BasicAuthClient(UsernamePasswordAuthenticator usernamePasswordAuthenticator)
public BasicAuthClient(UsernamePasswordAuthenticator usernamePasswordAuthenticator, UsernameProfileCreator profilePopulator)
protected void internalInit()
internalInit
in class AbstractHeaderClient<UsernamePasswordCredentials>
protected BasicAuthClient newClient()
newClient
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
protected RedirectAction retrieveRedirectAction(WebContext context)
retrieveRedirectAction
in class AbstractHeaderClient<UsernamePasswordCredentials>
protected UsernamePasswordCredentials retrieveCredentialsFromHeader(String header)
retrieveCredentialsFromHeader
in class AbstractHeaderClient<UsernamePasswordCredentials>
public String toString()
toString
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
public Mechanism getMechanism()
getMechanism
in class BaseClient<UsernamePasswordCredentials,HttpProfile>
Copyright © 2015. All Rights Reserved.