Package org.glassfish.tyrus.client.auth
Class AuthConfig.Builder
- java.lang.Object
-
- org.glassfish.tyrus.client.auth.AuthConfig.Builder
-
- Enclosing class:
- AuthConfig
public static final class AuthConfig.Builder extends java.lang.Object
The AuthConfig.Builder is a class used for creating an instance ofAuthConfig
for purpose of HTTP Authentication.Example 1 - building an authentication configuration enhanced with user defined NTLM authentication and overridden Basic Authentication:
Example 2 - Building an authentication configuration with disabled Basic scheme authenticator:AuthConfig authConfig = AuthConfig.Builder.create(). registerAuthProvider("NTLM", myAuthenticator). registerAuthProvider("Basic", myBasicAuthenticator). build();
AuthConfig authConfig = AuthConfig.Builder.create(). disableProvidedBasicAuth(). build();
- See Also:
Credentials
,Authenticator
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthConfig
build()
Build an instance ofAuthConfig
.static AuthConfig.Builder
create()
Create newAuthConfig.Builder
instance, which contains provided Basic and Digest authenticators.AuthConfig.Builder
disableProvidedBasicAuth()
Disable provided BasicAuthenticator
.AuthConfig.Builder
disableProvidedDigestAuth()
Disable provided DigestAuthenticator
.AuthConfig.Builder
registerAuthProvider(java.lang.String scheme, Authenticator authenticator)
RegisterAuthenticator
for provided authentication scheme.
-
-
-
Method Detail
-
create
public static AuthConfig.Builder create()
Create newAuthConfig.Builder
instance, which contains provided Basic and Digest authenticators.- Returns:
AuthConfig.Builder
instance.
-
registerAuthProvider
public final AuthConfig.Builder registerAuthProvider(java.lang.String scheme, Authenticator authenticator)
RegisterAuthenticator
for provided authentication scheme.Only one
Authenticator
for one authentication scheme can be registered. If current builder instance already containsAuthenticator
for provided scheme, existing authenticator will be replaced. Note that schemes are compared in case insensitive manner.- Parameters:
scheme
- authentication scheme for which the registered authenticator will be used. Scheme is compared case insensitive.authenticator
-Authenticator
instance to be registered.- Returns:
- updated
AuthConfig.Builder
instance.
-
disableProvidedBasicAuth
public final AuthConfig.Builder disableProvidedBasicAuth()
Disable provided BasicAuthenticator
.- Returns:
- updated
AuthConfig.Builder
instance.
-
disableProvidedDigestAuth
public final AuthConfig.Builder disableProvidedDigestAuth()
Disable provided DigestAuthenticator
.- Returns:
- updated
AuthConfig.Builder
instance.
-
build
public AuthConfig build()
Build an instance ofAuthConfig
.- Returns:
- an instance of
AuthConfig
.
-
-