final class BasicAuthenticator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private HttpAuthenticationFilter.Credentials |
defaultCredentials |
Constructor and Description |
---|
BasicAuthenticator(HttpAuthenticationFilter.Credentials defaultCredentials)
Creates a new instance of basic authenticator.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
calculateAuthentication(HttpAuthenticationFilter.Credentials credentials) |
void |
filterRequest(javax.ws.rs.client.ClientRequestContext request)
Adds authentication information to the request.
|
boolean |
filterResponseAndAuthenticate(javax.ws.rs.client.ClientRequestContext request,
javax.ws.rs.client.ClientResponseContext response)
Checks the response and if basic authentication is required then performs a new request
with basic authentication.
|
private final HttpAuthenticationFilter.Credentials defaultCredentials
BasicAuthenticator(HttpAuthenticationFilter.Credentials defaultCredentials)
defaultCredentials
- Credentials. Can be null
if no default credentials should be
used.private java.lang.String calculateAuthentication(HttpAuthenticationFilter.Credentials credentials)
public void filterRequest(javax.ws.rs.client.ClientRequestContext request) throws RequestAuthenticationException
request
- Request context.RequestAuthenticationException
- in case that basic credentials missing or are in invalid formatpublic boolean filterResponseAndAuthenticate(javax.ws.rs.client.ClientRequestContext request, javax.ws.rs.client.ClientResponseContext response)
request
- Request context.response
- Response context (will be updated with newest response data if the request was repeated).true
if response does not require authentication or if authentication is required,
new request was done with digest authentication information and authentication was successful.ResponseAuthenticationException
- in case that basic credentials missing or are in invalid format