Class OauthClientConfigurationBuilder
java.lang.Object
io.micronaut.security.oauth2.configuration.OauthClientConfigurationBuilder
Builder for programmatic
OauthClientConfiguration instances.- Since:
- 5.1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull OauthClientConfigurationBuilderauthorization(@NonNull OauthAuthorizationEndpointConfiguration authorization) Sets the authorization endpoint configuration.@NonNull OauthClientConfigurationBuilderauthorization(@NonNull String url) Sets the authorization endpoint URL.@NonNull OauthClientConfigurationBuilderauthorization(@NonNull String url, @Nullable String codeChallengeMethod) Sets the authorization endpoint URL and PKCE code challenge method.@NonNull OauthClientConfigurationBuilderauthorizationServer(@Nullable AuthorizationServer authorizationServer) Sets the authorization server type.@NonNull OauthClientConfigurationbuild()Builds the OAuth client configuration.@NonNull OauthClientConfigurationBuilderEnables client credentials support without requesting a scope.@NonNull OauthClientConfigurationBuilderclientCredentials(@Nullable String scope) Enables client credentials support with the supplied scope.@NonNull OauthClientConfigurationBuilderclientCredentials(@Nullable String scope, @NonNull Duration advancedExpiration) Enables client credentials support with the supplied scope and advanced expiration.@NonNull OauthClientConfigurationBuilderclientCredentials(@Nullable String scope, @NonNull Duration advancedExpiration, @NonNull Map<String, String> additionalRequestParams) Enables client credentials support with additional token request parameters.@NonNull OauthClientConfigurationBuilderclientCredentialsConfiguration(@NonNull ClientCredentialsConfiguration clientCredentials) Sets the client credentials configuration and selects the client credentials grant.@NonNull OauthClientConfigurationBuilderSets the OAuth client identifier.@NonNull OauthClientConfigurationBuilderclientSecret(@Nullable String clientSecret) Sets the OAuth client secret.@NonNull OauthClientConfigurationBuilderenabled(boolean enabled) Sets whether the OAuth client configuration is enabled.@NonNull OauthClientConfigurationBuilderSets the OAuth grant type.@NonNull OauthClientConfigurationBuilderintrospection(@NonNull SecureEndpointConfiguration introspection) Sets the token introspection endpoint configuration.@NonNull OauthClientConfigurationBuilderintrospection(@NonNull String url) Sets the token introspection endpoint URL.@NonNull OauthClientConfigurationBuilderintrospection(@NonNull String url, @Nullable String authenticationMethod) Sets the token introspection endpoint URL and authentication method.@NonNull OauthClientConfigurationBuilderSets the OAuth client configuration name.@NonNull OauthClientConfigurationBuilderopenid(@NonNull OpenIdClientConfiguration openid) Sets the OpenID client configuration.@NonNull OauthClientConfigurationBuilderproxyWellKnownOauthAuthorizationServer(boolean proxyWellKnownOauthAuthorizationServer) Sets whether the OAuth authorization server metadata endpoint is proxied.@NonNull OauthClientConfigurationBuilderproxyWellKnownOpenidConfiguration(boolean proxyWellKnownOpenidConfiguration) Sets whether the OpenID provider metadata endpoint is proxied.@NonNull OauthClientConfigurationBuilderrevocation(@NonNull SecureEndpointConfiguration revocation) Sets the token revocation endpoint configuration.@NonNull OauthClientConfigurationBuilderrevocation(@NonNull String url) Sets the token revocation endpoint URL.@NonNull OauthClientConfigurationBuilderrevocation(@NonNull String url, @Nullable String authenticationMethod) Sets the token revocation endpoint URL and authentication method.@NonNull OauthClientConfigurationBuilderSets the requested scopes for the OAuth client.@NonNull OauthClientConfigurationBuilderSets the requested scopes for the OAuth client.@NonNull OauthClientConfigurationBuildertoken(@NonNull SecureEndpointConfiguration token) Sets the token endpoint configuration.@NonNull OauthClientConfigurationBuilderSets the token endpoint URL.@NonNull OauthClientConfigurationBuilderSets the token endpoint URL and authentication method.@NonNull OauthClientConfigurationBuildertoken(@NonNull String url, @Nullable String authenticationMethod, @NonNull io.micronaut.http.MediaType contentType) Sets the token endpoint URL, authentication method, and content type.
-
Constructor Details
-
OauthClientConfigurationBuilder
public OauthClientConfigurationBuilder()
-
-
Method Details
-
name
Sets the OAuth client configuration name.- Parameters:
name- The OAuth client configuration name.- Returns:
- This builder.
-
clientId
Sets the OAuth client identifier.- Parameters:
clientId- The OAuth client identifier.- Returns:
- This builder.
-
clientSecret
Sets the OAuth client secret.- Parameters:
clientSecret- The OAuth client secret.- Returns:
- This builder.
-
scopes
Sets the requested scopes for the OAuth client.- Parameters:
scopes- The requested scopes.- Returns:
- This builder.
-
scopes
Sets the requested scopes for the OAuth client.- Parameters:
scopes- The requested scopes.- Returns:
- This builder.
-
enabled
Sets whether the OAuth client configuration is enabled.- Parameters:
enabled- Whether the OAuth client configuration is enabled.- Returns:
- This builder.
-
grantType
Sets the OAuth grant type.- Parameters:
grantType- The OAuth grant type.- Returns:
- This builder.
-
token
Sets the token endpoint configuration.- Parameters:
token- The token endpoint configuration.- Returns:
- This builder.
-
token
Sets the token endpoint URL.- Parameters:
url- The token endpoint URL.- Returns:
- This builder.
-
token
public @NonNull OauthClientConfigurationBuilder token(@NonNull String url, @Nullable String authenticationMethod) Sets the token endpoint URL and authentication method.- Parameters:
url- The token endpoint URL.authenticationMethod- The token endpoint authentication method.- Returns:
- This builder.
-
token
public @NonNull OauthClientConfigurationBuilder token(@NonNull String url, @Nullable String authenticationMethod, @NonNull io.micronaut.http.MediaType contentType) Sets the token endpoint URL, authentication method, and content type.- Parameters:
url- The token endpoint URL.authenticationMethod- The token endpoint authentication method.contentType- The token endpoint request content type.- Returns:
- This builder.
-
authorization
public @NonNull OauthClientConfigurationBuilder authorization(@NonNull OauthAuthorizationEndpointConfiguration authorization) Sets the authorization endpoint configuration.- Parameters:
authorization- The authorization endpoint configuration.- Returns:
- This builder.
-
authorization
Sets the authorization endpoint URL.- Parameters:
url- The authorization endpoint URL.- Returns:
- This builder.
-
authorization
public @NonNull OauthClientConfigurationBuilder authorization(@NonNull String url, @Nullable String codeChallengeMethod) Sets the authorization endpoint URL and PKCE code challenge method.- Parameters:
url- The authorization endpoint URL.codeChallengeMethod- The PKCE code challenge method.- Returns:
- This builder.
-
clientCredentialsConfiguration
public @NonNull OauthClientConfigurationBuilder clientCredentialsConfiguration(@NonNull ClientCredentialsConfiguration clientCredentials) Sets the client credentials configuration and selects the client credentials grant.- Parameters:
clientCredentials- The client credentials configuration.- Returns:
- This builder.
-
clientCredentials
Enables client credentials support without requesting a scope.- Returns:
- This builder.
-
clientCredentials
Enables client credentials support with the supplied scope.- Parameters:
scope- The client credentials scope.- Returns:
- This builder.
-
clientCredentials
public @NonNull OauthClientConfigurationBuilder clientCredentials(@Nullable String scope, @NonNull Duration advancedExpiration) Enables client credentials support with the supplied scope and advanced expiration.- Parameters:
scope- The client credentials scope.advancedExpiration- The duration before token expiry to consider the token expired.- Returns:
- This builder.
-
clientCredentials
public @NonNull OauthClientConfigurationBuilder clientCredentials(@Nullable String scope, @NonNull Duration advancedExpiration, @NonNull Map<String, String> additionalRequestParams) Enables client credentials support with additional token request parameters.- Parameters:
scope- The client credentials scope.advancedExpiration- The duration before token expiry to consider the token expired.additionalRequestParams- Additional request parameters for the token request.- Returns:
- This builder.
-
introspection
public @NonNull OauthClientConfigurationBuilder introspection(@NonNull SecureEndpointConfiguration introspection) Sets the token introspection endpoint configuration.- Parameters:
introspection- The token introspection endpoint configuration.- Returns:
- This builder.
-
introspection
Sets the token introspection endpoint URL.- Parameters:
url- The token introspection endpoint URL.- Returns:
- This builder.
-
introspection
public @NonNull OauthClientConfigurationBuilder introspection(@NonNull String url, @Nullable String authenticationMethod) Sets the token introspection endpoint URL and authentication method.- Parameters:
url- The token introspection endpoint URL.authenticationMethod- The introspection endpoint authentication method.- Returns:
- This builder.
-
revocation
public @NonNull OauthClientConfigurationBuilder revocation(@NonNull SecureEndpointConfiguration revocation) Sets the token revocation endpoint configuration.- Parameters:
revocation- The token revocation endpoint configuration.- Returns:
- This builder.
-
revocation
Sets the token revocation endpoint URL.- Parameters:
url- The token revocation endpoint URL.- Returns:
- This builder.
-
revocation
public @NonNull OauthClientConfigurationBuilder revocation(@NonNull String url, @Nullable String authenticationMethod) Sets the token revocation endpoint URL and authentication method.- Parameters:
url- The token revocation endpoint URL.authenticationMethod- The revocation endpoint authentication method.- Returns:
- This builder.
-
openid
Sets the OpenID client configuration.- Parameters:
openid- The OpenID client configuration.- Returns:
- This builder.
-
authorizationServer
public @NonNull OauthClientConfigurationBuilder authorizationServer(@Nullable AuthorizationServer authorizationServer) Sets the authorization server type.- Parameters:
authorizationServer- The authorization server type.- Returns:
- This builder.
-
proxyWellKnownOauthAuthorizationServer
public @NonNull OauthClientConfigurationBuilder proxyWellKnownOauthAuthorizationServer(boolean proxyWellKnownOauthAuthorizationServer) Sets whether the OAuth authorization server metadata endpoint is proxied.- Parameters:
proxyWellKnownOauthAuthorizationServer- Whether to proxy OAuth authorization server metadata.- Returns:
- This builder.
-
proxyWellKnownOpenidConfiguration
public @NonNull OauthClientConfigurationBuilder proxyWellKnownOpenidConfiguration(boolean proxyWellKnownOpenidConfiguration) Sets whether the OpenID provider metadata endpoint is proxied.- Parameters:
proxyWellKnownOpenidConfiguration- Whether to proxy OpenID provider metadata.- Returns:
- This builder.
-
build
Builds the OAuth client configuration.- Returns:
- The OAuth client configuration.
-