Class BasicAuthenticator
- java.lang.Object
-
- org.glassfish.jersey.client.authentication.BasicAuthenticator
-
final class BasicAuthenticator extends java.lang.ObjectImplementation of Basic Http Authentication method (RFC 2617).
-
-
Field Summary
Fields Modifier and Type Field Description private HttpAuthenticationFilter.CredentialsdefaultCredentials
-
Constructor Summary
Constructors Constructor Description BasicAuthenticator(HttpAuthenticationFilter.Credentials defaultCredentials)Creates a new instance of basic authenticator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringcalculateAuthentication(HttpAuthenticationFilter.Credentials credentials)voidfilterRequest(javax.ws.rs.client.ClientRequestContext request)Adds authentication information to the request.booleanfilterResponseAndAuthenticate(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 Detail
-
defaultCredentials
private final HttpAuthenticationFilter.Credentials defaultCredentials
-
-
Constructor Detail
-
BasicAuthenticator
BasicAuthenticator(HttpAuthenticationFilter.Credentials defaultCredentials)
Creates a new instance of basic authenticator.- Parameters:
defaultCredentials- Credentials. Can benullif no default credentials should be used.
-
-
Method Detail
-
calculateAuthentication
private java.lang.String calculateAuthentication(HttpAuthenticationFilter.Credentials credentials)
-
filterRequest
public void filterRequest(javax.ws.rs.client.ClientRequestContext request) throws RequestAuthenticationExceptionAdds 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:
trueif 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
-
-