public abstract class BaseClient<C extends Credentials,U extends CommonProfile> extends InitializableWebObject implements Client<C,U>, Cloneable
This class is the default implementation of an authentication client (whatever the protocol). 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 clientclone()
method, the newClient()
method must be implemented in sub-classes to
create a new instancesetName(String)
and getName()
methodsgetClientType()
method returns the implemented ClientType
by the client.AuthorizationGenerator
.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) |
BaseClient<C,U> |
clone()
Clone the current client.
|
List<AuthorizationGenerator<U>> |
getAuthorizationGenerators() |
abstract ClientType |
getClientType()
Return the client type.
|
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 BaseClient<C,U> |
newClient()
Create a new instance of the client.
|
protected abstract U |
retrieveUserProfile(C credentials,
WebContext context) |
void |
setAuthorizationGenerator(AuthorizationGenerator<U> authorizationGenerator)
Add only one authorization generator.
|
void |
setAuthorizationGenerators(AuthorizationGenerator<U>... authorizationGenerators) |
void |
setAuthorizationGenerators(List<AuthorizationGenerator<U>> authorizationGenerators) |
void |
setName(String name) |
String |
toString() |
init, internalInit, reinit
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCredentials, redirect
public BaseClient<C,U> clone()
protected abstract BaseClient<C,U> newClient()
public void setName(String name)
public String getName()
Client
getName
in interface Client<C extends Credentials,U extends CommonProfile>
public final U getUserProfile(C credentials, WebContext context)
getUserProfile
in interface Client<C extends Credentials,U extends CommonProfile>
credentials
- credentialscontext
- web contextprotected abstract U retrieveUserProfile(C credentials, WebContext context)
public abstract ClientType getClientType()
public void addAuthorizationGenerator(AuthorizationGenerator<U> authorizationGenerator)
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 generatorCopyright © 2016. All rights reserved.