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.| 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(List<AuthorizationGenerator<U>> authorizationGenerators) |
List<AuthorizationGenerator<U>> |
getAuthorizationGenerators() |
String |
getName()
Get the name of the client.
|
U |
getUserProfile(C credentials,
WebContext context)
Get the user profile based on the provided credentials.
|
protected abstract C |
retrieveCredentials(WebContext context)
Retrieve the credentials.
|
protected abstract U |
retrieveUserProfile(C credentials,
WebContext context)
Retrieve a user userprofile.
|
void |
setAuthorizationGenerator(AuthorizationGenerator<U> authorizationGenerator)
Add an authorization generator.
|
void |
setAuthorizationGenerators(AuthorizationGenerator<U>... authorizationGenerators) |
void |
setAuthorizationGenerators(List<AuthorizationGenerator<U>> authorizationGenerators) |
void |
setName(String name) |
String |
toString() |
init, internalInit, reinitclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCredentials, redirectprotected abstract 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 abstract 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()
ClientgetName in interface Client<C extends Credentials,U extends CommonProfile>public 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)
Copyright © 2016. All rights reserved.