Package org.glassfish.tyrus.client.auth
Class Authenticator
- java.lang.Object
-
- org.glassfish.tyrus.client.auth.Authenticator
-
@Beta public abstract class Authenticator extends java.lang.ObjectAuthenticator 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:
AuthConfig.Builder.registerAuthProvider(String, Authenticator),ClientProperties.AUTH_CONFIG,ClientProperties.CREDENTIALS
-
-
Constructor Summary
Constructors Constructor Description Authenticator()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract java.lang.StringgenerateAuthorizationHeader(java.net.URI uri, java.lang.String wwwAuthenticateHeader, Credentials credentials)Generate value used as ""Authorization"" header value for next request.
-
-
-
Method Detail
-
generateAuthorizationHeader
public abstract java.lang.String generateAuthorizationHeader(java.net.URI uri, java.lang.String wwwAuthenticateHeader, Credentials credentials) throws AuthenticationExceptionGenerate value used as ""Authorization"" header value for next request.Thrown
AuthenticationExceptionwill be wrapped asDeploymentExceptionand 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 benullwhen there were noCredentialsregistered.- Returns:
- value for "Authorization" header which will be put into next handshake request.
- Throws:
AuthenticationException- when it is not possible to create ""Authorization"" header.
-
-