Package org.restlet.engine.security
Class AuthenticatorHelper
java.lang.Object
org.restlet.engine.Helper
org.restlet.engine.security.AuthenticatorHelper
- Direct Known Subclasses:
HttpBasicHelper
Base class for authentication helpers.
- Author:
- Jerome Louvel
-
Constructor Summary
ConstructorsConstructorDescriptionAuthenticatorHelper(ChallengeScheme challengeScheme, boolean clientSide, boolean serverSide) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidformatRequest(ChallengeWriter cw, ChallengeRequest challenge, Response response, Series<Header> httpHeaders) Formats a challenge request as raw credentials.voidformatResponse(ChallengeWriter cw, ChallengeResponse challenge, Request request, Series<Header> httpHeaders) Formats a challenge response as raw credentials.Returns the supported challenge scheme.Returns the context's logger.booleanIndicates if client side authentication is supported.booleanIndicates if server side authentication is supported.voidparseRequest(ChallengeRequest challenge, Response response, Series<Header> httpHeaders) Parses an authenticate header into a challenge request.voidparseResponse(ChallengeResponse challenge, Request request, Series<Header> httpHeaders) Parses an authorization header into a challenge response.voidsetChallengeScheme(ChallengeScheme challengeScheme) Sets the supported challenge scheme.voidsetClientSide(boolean clientSide) Indicates if client side authentication is supported.voidsetServerSide(boolean serverSide) Indicates if server side authentication is supported.updateReference(Reference resourceRef, ChallengeResponse challengeResponse, Request request) Optionally updates the request with a challenge response before sending it.
-
Constructor Details
-
AuthenticatorHelper
Constructor.- Parameters:
challengeScheme- The supported challenge scheme.clientSide- Indicates if client side authentication is supported.serverSide- Indicates if server side authentication is supported.
-
-
Method Details
-
formatRequest
public void formatRequest(ChallengeWriter cw, ChallengeRequest challenge, Response response, Series<Header> httpHeaders) throws IOException Formats a challenge request as raw credentials.- Parameters:
cw- The header writer to update.challenge- The challenge request to format.response- The parent response.httpHeaders- The current request HTTP headers.- Throws:
IOException
-
formatResponse
public void formatResponse(ChallengeWriter cw, ChallengeResponse challenge, Request request, Series<Header> httpHeaders) Formats a challenge response as raw credentials.- Parameters:
cw- The header writer to update.challenge- The challenge response to format.request- The parent request.httpHeaders- The current request HTTP headers.
-
getChallengeScheme
Returns the supported challenge scheme.- Returns:
- The supported challenge scheme.
-
getLogger
Returns the context's logger.- Returns:
- The context's logger.
-
isClientSide
public boolean isClientSide()Indicates if client side authentication is supported.- Returns:
- True if client side authentication is supported.
-
isServerSide
public boolean isServerSide()Indicates if server side authentication is supported.- Returns:
- True if server side authentication is supported.
-
parseRequest
Parses an authenticate header into a challenge request. The header isHeaderConstants.HEADER_WWW_AUTHENTICATE.- Parameters:
challenge- The challenge request to update.response- The parent response.httpHeaders- The current response HTTP headers.
-
parseResponse
Parses an authorization header into a challenge response. The header isHeaderConstants.HEADER_AUTHORIZATION.- Parameters:
challenge- The challenge response to update.request- The parent request.httpHeaders- The current request HTTP headers.
-
setChallengeScheme
Sets the supported challenge scheme.- Parameters:
challengeScheme- The supported challenge scheme.
-
setClientSide
public void setClientSide(boolean clientSide) Indicates if client side authentication is supported.- Parameters:
clientSide- True if client side authentication is supported.
-
setServerSide
public void setServerSide(boolean serverSide) Indicates if server side authentication is supported.- Parameters:
serverSide- True if server side authentication is supported.
-
updateReference
public Reference updateReference(Reference resourceRef, ChallengeResponse challengeResponse, Request request) Optionally updates the request with a challenge response before sending it. This is sometimes useful for authentication schemes that aren't based on the Authorization header but instead on URI query parameters or other headers. By default it returns the resource URI reference unchanged.- Parameters:
resourceRef- The resource URI reference to update.challengeResponse- The challenge response provided.request- The request to update.- Returns:
- The original URI reference if unchanged or a new one if updated.
-