Class JdkAuthFactory
java.lang.Object
io.apicurio.registry.client.common.auth.JdkAuthFactory
Factory class for creating authentication-enabled components for JDK HttpClient.
Provides OAuth2 client credentials flow and Basic authentication support.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOAuth2 token provider implementation using client credentials flow.static interfaceInterface for providing authentication tokens. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildBasicAuthHeaderValue(String username, String password) Creates a Basic authentication header value.static JdkAuthFactory.TokenProviderbuildOAuth2TokenProvider(HttpClient httpClient, String tokenEndpoint, String clientId, String clientSecret, String scope) Creates an OAuth2 token provider that handles client credentials flow.static AuthenticatorbuildProxyAuthenticator(String username, String password) Creates an Authenticator for proxy authentication.
-
Method Details
-
buildBasicAuthHeaderValue
Creates a Basic authentication header value.- Parameters:
username- the usernamepassword- the password- Returns:
- the Base64-encoded Authorization header value (e.g., "Basic dXNlcjpwYXNz")
-
buildProxyAuthenticator
Creates an Authenticator for proxy authentication.- Parameters:
username- the proxy usernamepassword- the proxy password- Returns:
- an Authenticator configured for the proxy credentials
-
buildOAuth2TokenProvider
public static JdkAuthFactory.TokenProvider buildOAuth2TokenProvider(HttpClient httpClient, String tokenEndpoint, String clientId, String clientSecret, String scope) Creates an OAuth2 token provider that handles client credentials flow. The token provider caches tokens and automatically refreshes them before expiry.- Parameters:
httpClient- the HttpClient to use for token requeststokenEndpoint- the OAuth2 token endpoint URLclientId- the OAuth2 client IDclientSecret- the OAuth2 client secretscope- the OAuth2 scope (optional, can be null)- Returns:
- a TokenProvider that supplies valid access tokens
-