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

public Class AuthConfig

extends Object
Class Inheritance
Annotations
@Beta
Imports
java.nio.charset.Charset, java.util.Collections, .Map, .TreeMap, org.glassfish.tyrus.client.ClientManager, org.glassfish.tyrus.core.Beta

AuthConfig serves as a configuration of HTTP authentication.

An instance of this class can be created by AuthConfig and it must be registered to property bag in ClientManager.

Author
Ondrej Kosatka
See Also
Authenticator, ClientManager#getProperties()

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AuthConfig.Builder

The AuthConfig.Builder is a class used for creating an instance of AuthConfig for purpose of HTTP Authentication.

Field Summary

Modifier and TypeField and Description
private final Map<String, Authenticator>
pack-priv static final String
BASIC

Basic authentication scheme key.

pack-priv static final Charset
CHARACTER_SET

Encoding used for authentication calculations.

pack-priv static final String
DIGEST

Digest authentication scheme key.

Constructor Summary

AccessConstructor and Description
private
AuthConfig(Map<String, Authenticator> authenticators)

Method Summary

Modifier and TypeMethod and Description
public static AuthConfig.Builder

Returns:

builder instance.
builder
()

Create new Builder instance, which contains provided Basic and Digest authenticators.

public Map<String, Authenticator>

Returns:

unmodifiable map of authenticators. Case insensitive authentication scheme is mapped to Authenticator.
getAuthenticators
()

Get an unmodifiable map of authenticators, where case insensitive authentication scheme to Authenticator.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

authenticatorsback to summary
private final Map<String, Authenticator> authenticators
BASICback to summary
pack-priv static final String BASIC

Basic authentication scheme key.

CHARACTER_SETback to summary
pack-priv static final Charset CHARACTER_SET

Encoding used for authentication calculations.

DIGESTback to summary
pack-priv static final String DIGEST

Digest authentication scheme key.

Constructor Detail

AuthConfigback to summary
private AuthConfig(Map<String, Authenticator> authenticators)

Method Detail

builderback to summary
public static AuthConfig.Builder builder()

Create new Builder instance, which contains provided Basic and Digest authenticators.

Returns:AuthConfig.Builder

builder instance.

getAuthenticatorsback to summary
public Map<String, Authenticator> getAuthenticators()

Get an unmodifiable map of authenticators, where case insensitive authentication scheme to Authenticator.

Returns:Map<String, Authenticator>

unmodifiable map of authenticators. Case insensitive authentication scheme is mapped to Authenticator.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.glassfish.tyrus.client.auth back to summary

public final Class AuthConfig.Builder

extends Object
Class Inheritance

The AuthConfig.Builder is a class used for creating an instance of AuthConfig for purpose of HTTP Authentication.

Example 1 - building an authentication configuration enhanced with user defined NTLM authentication and overridden Basic Authentication:


AuthConfig authConfig = AuthConfig.Builder.create().
                         registerAuthProvider("NTLM", myAuthenticator).
                         registerAuthProvider("Basic", myBasicAuthenticator).
                         build();
Example 2 - Building an authentication configuration with disabled Basic scheme authenticator:

AuthConfig authConfig = AuthConfig.Builder.create().
                         disableProvidedBasicAuth().
                         build();
See Also
Credentials, Authenticator

Field Summary

Modifier and TypeField and Description
private final Map<String, Authenticator>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public AuthConfig

Returns:

an instance of AuthConfig.
build
()

Build an instance of AuthConfig.

public static AuthConfig.Builder

Returns:

AuthConfig.Builder instance.
create
()

Create new Builder instance, which contains provided Basic and Digest authenticators.

public final AuthConfig.Builder

Returns:

updated AuthConfig.Builder instance.
disableProvidedBasicAuth
()

Disable provided Basic Authenticator.

public final AuthConfig.Builder

Returns:

updated AuthConfig.Builder instance.
disableProvidedDigestAuth
()

Disable provided Digest Authenticator.

public final AuthConfig.Builder

Returns:

updated AuthConfig.Builder instance.
registerAuthProvider
(final String
authentication scheme for which the registered authenticator will be used. Scheme is compared case insensitive.
scheme
,
final Authenticator
Authenticator instance to be registered.
authenticator
)

Register Authenticator for provided authentication scheme.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

authenticatorsback to summary
private final Map<String, Authenticator> authenticators

Constructor Detail

Builderback to summary
private Builder()

Method Detail

buildback to summary
public AuthConfig build()

Build an instance of AuthConfig.

Returns:AuthConfig

an instance of AuthConfig.

createback to summary
public static AuthConfig.Builder create()

Create new Builder instance, which contains provided Basic and Digest authenticators.

Returns:AuthConfig.Builder

AuthConfig.Builder instance.

disableProvidedBasicAuthback to summary
public final AuthConfig.Builder disableProvidedBasicAuth()

Disable provided Basic Authenticator.

Returns:AuthConfig.Builder

updated AuthConfig.Builder instance.

disableProvidedDigestAuthback to summary
public final AuthConfig.Builder disableProvidedDigestAuth()

Disable provided Digest Authenticator.

Returns:AuthConfig.Builder

updated AuthConfig.Builder instance.

registerAuthProviderback to summary
public final AuthConfig.Builder registerAuthProvider(final String scheme, final Authenticator authenticator)

Register Authenticator for provided authentication scheme.

Only one Authenticator for one authentication scheme can be registered. If current builder instance already contains Authenticator for provided scheme, existing authenticator will be replaced. Note that schemes are compared in case insensitive manner.

Parameters
scheme:String

authentication scheme for which the registered authenticator will be used. Scheme is compared case insensitive.

authenticator:Authenticator

Authenticator instance to be registered.

Returns:AuthConfig.Builder

updated AuthConfig.Builder instance.