public class RestAuthenticator extends ProfileDefinitionAware<RestProfile> implements Authenticator<UsernamePasswordCredentials>
| Constructor and Description |
|---|
RestAuthenticator() |
RestAuthenticator(String url) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildProfile(UsernamePasswordCredentials credentials,
String body) |
protected String |
callRestApi(String username,
String password)
Return the body from the REST API, passing the username/pasword auth.
|
com.fasterxml.jackson.databind.ObjectMapper |
getMapper() |
String |
getUrl() |
protected void |
internalInit(WebContext context)
Internal initialization of the object.
|
void |
setMapper(com.fasterxml.jackson.databind.ObjectMapper mapper) |
void |
setUrl(String url) |
String |
toString() |
void |
validate(UsernamePasswordCredentials credentials,
WebContext context)
Validate the credentials.
|
defaultProfileDefinition, getProfileDefinition, setProfileDefinitioninit, reinitpublic RestAuthenticator()
public RestAuthenticator(String url)
protected void internalInit(WebContext context)
InitializableWebObjectinternalInit in class InitializableWebObjectcontext - the web contextpublic void validate(UsernamePasswordCredentials credentials, WebContext context) throws HttpAction, CredentialsException
AuthenticatorCredentialsException in case of failure.validate in interface Authenticator<UsernamePasswordCredentials>credentials - the given credentialscontext - the web contextHttpAction - requires a specific HTTP action if necessaryCredentialsException - the credentials are invalidprotected void buildProfile(UsernamePasswordCredentials credentials, String body) throws HttpAction, CredentialsException
HttpActionCredentialsExceptionprotected String callRestApi(String username, String password) throws HttpAction, CredentialsException
username - the usernamepassword - the passwordHttpAction - whether an extra HTTP action is requiredCredentialsException - whether an authentication error occurspublic String getUrl()
public void setUrl(String url)
public com.fasterxml.jackson.databind.ObjectMapper getMapper()
public void setMapper(com.fasterxml.jackson.databind.ObjectMapper mapper)
Copyright © 2018. All rights reserved.