public abstract class Authenticator extends Filter
ClientInfo
property.Constructor and Description |
---|
Authenticator(Context context)
Constructor setting the mode to "required".
|
Authenticator(Context context,
boolean optional)
Constructor using the context's default enroler.
|
Authenticator(Context context,
boolean multiAuthenticating,
boolean optional,
Enroler enroler)
Constructor.
|
Authenticator(Context context,
boolean optional,
Enroler enroler)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
authenticate(Request request,
Response response)
Attempts to authenticate the subject sending the request.
|
protected int |
authenticated(Request request,
Response response)
Invoked upon successful authentication.
|
protected int |
beforeHandle(Request request,
Response response)
Handles the authentication by first invoking the
authenticate(Request, Response) method, only if
isMultiAuthenticating() returns true and if
ClientInfo.isAuthenticated() returns false. |
Enroler |
getEnroler()
Returns the enroler invoked upon successful authentication to update the
subject with new principals.
|
boolean |
isMultiAuthenticating()
Indicates if the authenticator should attempt to authenticate an already
authenticated client.
|
boolean |
isOptional()
Indicates if the authenticator is not required to succeed.
|
void |
setEnroler(Enroler enroler)
Sets the enroler invoked upon successful authentication.
|
void |
setMultiAuthenticating(boolean multiAuthenticating)
Indicates if the authenticator should attempt to authenticate an already
authenticated client.
|
void |
setOptional(boolean optional)
Indicates if the authenticator is not required to succeed.
|
protected int |
unauthenticated(Request request,
Response response)
Invoked upon failed authentication.
|
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner
public Authenticator(Context context)
context
- The context.Authenticator(Context, boolean)
public Authenticator(Context context, boolean optional)
context
- The context.optional
- Indicates if the authenticator is not required to succeed.Authenticator(Context, boolean, Enroler)
public Authenticator(Context context, boolean multiAuthenticating, boolean optional, Enroler enroler)
context
- The context.multiAuthenticating
- Indicates if the authenticator should attempt to authenticate
an already authenticated client.optional
- Indicates if the authenticator is not required to succeed.enroler
- The enroler to invoke upon successful authentication.protected abstract boolean authenticate(Request request, Response response)
request
- The request sent.response
- The response to update.protected int authenticated(Request request, Response response)
Filter.CONTINUE
.request
- The request sent.response
- The response to update.protected int beforeHandle(Request request, Response response)
authenticate(Request, Response)
method, only if
isMultiAuthenticating()
returns true and if
ClientInfo.isAuthenticated()
returns false. If the method is
invoked and returns true, the authenticated(Request, Response)
is called. Otherwise, if isOptional()
returns true it continues
to the next Restlet or if it returns false it calls the
unauthenticated(Request, Response)
method.beforeHandle
in class Filter
request
- The request to handle.response
- The response to update.Filter.CONTINUE
or
Filter.SKIP
or Filter.STOP
.public Enroler getEnroler()
Role
are added based
on the available User
instances available.public boolean isMultiAuthenticating()
ClientInfo.isAuthenticated()
returns true. By default, it is set
to true.public boolean isOptional()
isMultiAuthenticating()
prevents multiple
authentications.public void setEnroler(Enroler enroler)
enroler
- The enroler invoked upon successful authentication.public void setMultiAuthenticating(boolean multiAuthenticating)
ClientInfo.isAuthenticated()
returns true. By default, it is set
to true.multiAuthenticating
- True if the authenticator should attempt to authenticate an
already authenticated client.public void setOptional(boolean optional)
isMultiAuthenticating()
prevents multiple
authentications.optional
- True if the authentication success is optional.protected int unauthenticated(Request request, Response response)
Filter.STOP
.request
- The request sent.response
- The response to update.Copyright © 2005-2024 Restlet.