Class BasicAuthenticator
java.lang.Object
org.glassfish.jersey.client.authentication.BasicAuthenticator
Implementation of Basic Http Authentication method (RFC 2617).
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBasicAuthenticator
(HttpAuthenticationFilter.Credentials defaultCredentials) Creates a new instance of basic authenticator. -
Method Summary
Modifier and TypeMethodDescriptionprivate String
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.
-
Field Details
-
defaultCredentials
-
-
Constructor Details
-
BasicAuthenticator
BasicAuthenticator(HttpAuthenticationFilter.Credentials defaultCredentials) Creates a new instance of basic authenticator.- Parameters:
defaultCredentials
- Credentials. Can benull
if no default credentials should be used.
-
-
Method Details
-
calculateAuthentication
-
filterRequest
public void filterRequest(javax.ws.rs.client.ClientRequestContext request) throws RequestAuthenticationException Adds authentication information to the request.- Parameters:
request
- Request context.- Throws:
RequestAuthenticationException
- in case that basic credentials missing or are in invalid format
-
filterResponseAndAuthenticate
public 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.- Parameters:
request
- Request context.response
- Response context (will be updated with newest response data if the request was repeated).- Returns:
true
if response does not require authentication or if authentication is required, new request was done with digest authentication information and authentication was successful.- Throws:
ResponseAuthenticationException
- in case that basic credentials missing or are in invalid format
-