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() methodsAuthorizationGeneratorClient.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() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAuthorizationGenerator(AuthorizationGenerator<U> authorizationGenerator) |
void |
addAuthorizationGenerators(java.util.List<AuthorizationGenerator<U>> authorizationGenerators) |
protected void |
defaultAuthenticator(Authenticator<C> authenticator) |
protected void |
defaultCredentialsExtractor(CredentialsExtractor<C> credentialsExtractor) |
protected void |
defaultProfileCreator(ProfileCreator<C,U> profileCreator) |
Authenticator<C> |
getAuthenticator() |
java.util.List<AuthorizationGenerator<U>> |
getAuthorizationGenerators() |
CredentialsExtractor<C> |
getCredentialsExtractor() |
java.lang.String |
getName()
Get the name of the client.
|
ProfileCreator<C,U> |
getProfileCreator() |
U |
getUserProfile(C credentials,
WebContext context)
Get the user profile based on the provided credentials.
|
void |
notifySessionRenewal(java.lang.String oldSessionId,
WebContext context)
Notify of the web session renewal.
|
protected C |
retrieveCredentials(WebContext context)
Retrieve the credentials.
|
protected U |
retrieveUserProfile(C credentials,
WebContext context)
Retrieve a user userprofile.
|
void |
setAuthenticator(Authenticator<C> authenticator) |
void |
setAuthorizationGenerator(AuthorizationGenerator<U> authorizationGenerator)
Add an authorization generator.
|
void |
setAuthorizationGenerators(AuthorizationGenerator<U>... authorizationGenerators) |
void |
setAuthorizationGenerators(java.util.List<AuthorizationGenerator<U>> authorizationGenerators) |
void |
setCredentialsExtractor(CredentialsExtractor<C> credentialsExtractor) |
void |
setName(java.lang.String name) |
void |
setProfileCreator(ProfileCreator<C,U> profileCreator) |
java.lang.String |
toString() |
init, internalInit, reinitclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCredentials, getLogoutAction, redirectprotected 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
ClientgetUserProfile 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(java.lang.String name)
public java.lang.String getName()
ClientgetName in interface Client<C extends Credentials,U extends CommonProfile>public void notifySessionRenewal(java.lang.String oldSessionId,
WebContext context)
oldSessionId - the old session identifiercontext - the web contextpublic java.util.List<AuthorizationGenerator<U>> getAuthorizationGenerators()
public void setAuthorizationGenerators(java.util.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(java.util.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)
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2018. All Rights Reserved.