Package org.glassfish.tyrus.client.auth
Class Authenticator
java.lang.Object
org.glassfish.tyrus.client.auth.Authenticator
Authenticator provides a way how to plug-in custom authentication provider.
Authenticator is called when server-side returns HTTP 401 as a reply to handshake response. Tyrus client then looks for authenticator instance registered to authentication scheme provided by server.
- Author:
- Ondrej Kosatka
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract String
generateAuthorizationHeader
(URI uri, String wwwAuthenticateHeader, Credentials credentials) Generate value used as ""Authorization"" header value for next request.
-
Constructor Details
-
Authenticator
public Authenticator()
-
-
Method Details
-
generateAuthorizationHeader
public abstract String generateAuthorizationHeader(URI uri, String wwwAuthenticateHeader, Credentials credentials) throws AuthenticationException Generate value used as ""Authorization"" header value for next request.Thrown
AuthenticationException
will be wrapped asDeploymentException
and thrown as a result ofWebSocketContainer
.connectToServer(...) method call.- Parameters:
uri
- Uri of the server endpoint.wwwAuthenticateHeader
- ""WWW-Authenticate"" header value received in a handshake response.credentials
- credentials passed by propertyClientProperties.CREDENTIALS
. Can benull
when there were noCredentials
registered.- Returns:
- value for "Authorization" header which will be put into next handshake request.
- Throws:
AuthenticationException
- when it is not possible to create ""Authorization"" header.
-