public abstract class BaseClient<C extends Credentials,U extends CommonProfile> extends InitializableWebObject implements Client<C,U>
This class is the default implementation of an authentication client (whatever the mechanism). It has the core concepts:
InitializableWebObject
inheritance, the InitializableWebObject.internalInit(WebContext)
must be implemented
in sub-classes. The InitializableWebObject.init(WebContext)
method must be called implicitly by the main methods of the Client
interface, so that no explicit call is
required to initialize the clientsetName(String)
and getName()
methodsAuthorizationGenerator
Client.getCredentials(WebContext)
method are handled by the credentialsExtractor
and authenticator
componentsgetUserProfile(Credentials, WebContext)
method is ensured by the profileCreator
component.Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
logger |
Constructor and Description |
---|
BaseClient() |
init, internalInit, reinit
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCredentials, getLogoutAction, redirect
protected C retrieveCredentials(WebContext context) throws HttpAction
context
- the web contextHttpAction
- whether an additional HTTP action is requiredpublic final U getUserProfile(C credentials, WebContext context) throws HttpAction
Client
getUserProfile
in interface Client<C extends Credentials,U extends CommonProfile>
credentials
- credentialscontext
- web contextHttpAction
- whether an additional HTTP action is requiredprotected final U retrieveUserProfile(C credentials, WebContext context) throws HttpAction
credentials
- the credentialscontext
- the web contextHttpAction
- whether an additional HTTP action is requiredpublic void setName(String name)
public String getName()
Client
getName
in interface Client<C extends Credentials,U extends CommonProfile>
public void notifySessionRenewal(String oldSessionId, WebContext context)
oldSessionId
- the old session identifiercontext
- the web contextpublic List<AuthorizationGenerator<U>> getAuthorizationGenerators()
public void setAuthorizationGenerators(List<AuthorizationGenerator<U>> authorizationGenerators)
public void setAuthorizationGenerators(AuthorizationGenerator<U>... authorizationGenerators)
public void setAuthorizationGenerator(AuthorizationGenerator<U> authorizationGenerator)
authorizationGenerator
- an authorizations generatorpublic void addAuthorizationGenerator(AuthorizationGenerator<U> authorizationGenerator)
public void addAuthorizationGenerators(List<AuthorizationGenerator<U>> authorizationGenerators)
public CredentialsExtractor<C> getCredentialsExtractor()
protected void defaultCredentialsExtractor(CredentialsExtractor<C> credentialsExtractor)
public Authenticator<C> getAuthenticator()
protected void defaultAuthenticator(Authenticator<C> authenticator)
public ProfileCreator<C,U> getProfileCreator()
protected void defaultProfileCreator(ProfileCreator<C,U> profileCreator)
public void setCredentialsExtractor(CredentialsExtractor<C> credentialsExtractor)
public void setAuthenticator(Authenticator<C> authenticator)
public void setProfileCreator(ProfileCreator<C,U> profileCreator)
Copyright © 2017. All rights reserved.