Top Description Constructors Methods
org.glassfish.tyrus.client.auth

public abstract Class Authenticator

extends Object
Class Inheritance
Known Direct Subclasses
org.glassfish.tyrus.client.auth.BasicAuthenticator, org.glassfish.tyrus.client.auth.DigestAuthenticator
Annotations
@Beta
Imports
java.net.URI, jakarta.websocket.DeploymentException, .WebSocketContainer, org.glassfish.tyrus.client.ClientProperties, org.glassfish.tyrus.core.Beta, org.glassfish.tyrus.spi.UpgradeRequest, .UpgradeResponse

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
AuthConfig.Builder#registerAuthProvider(String, Authenticator), ClientProperties#AUTH_CONFIG, ClientProperties#CREDENTIALS

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract String

Returns:

value for Authorization header which will be put into next handshake request.
generateAuthorizationHeader
(final URI
Uri of the server endpoint.
uri
,
final String
"WWW-Authenticate" header value received in a handshake response.
wwwAuthenticateHeader
,
final Credentials
credentials passed by property ClientProperties#CREDENTIALS. Can be null when there were no Credentials registered.
credentials
)

Generate value used as "Authorization" header value for next request.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Authenticatorback to summary
public Authenticator()

Method Detail

generateAuthorizationHeaderback to summary
public abstract String generateAuthorizationHeader(final URI uri, final String wwwAuthenticateHeader, final Credentials credentials) throws AuthenticationException

Generate value used as "Authorization" header value for next request.

Thrown AuthenticationException will be wrapped as DeploymentException and thrown as a result of WebSocketContainer.connectToServer(...) method call.

Parameters
uri:URI

Uri of the server endpoint.

wwwAuthenticateHeader:String

"WWW-Authenticate" header value received in a handshake response.

credentials:Credentials

credentials passed by property ClientProperties#CREDENTIALS. Can be null when there were no Credentials registered.

Returns:String

value for Authorization header which will be put into next handshake request.

Exceptions
AuthenticationException:
when it is not possible to create "Authorization" header.