Class McpTokenProvider.Builder
java.lang.Object
org.apache.juneau.rest.client.mcp.auth.McpTokenProvider.Builder
- Enclosing class:
- McpTokenProvider
Builder.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder(org.apache.juneau.rest.client.mcp.auth.McpTokenProvider.Mode mode) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the provider.Sets the OAuth client ID.clientSecret(String value) Sets the OAuth client secret as a literal string.clientSecretSupplier(Supplier<String> value) Sets the OAuth client secret via a supplier.Sets the clock used for token-expiry comparisons.expirySkew(Duration value) Sets the skew subtracted from a cached token's expiry before it is treated as expired.httpRequestConfigurator(Consumer<com.nimbusds.oauth2.sdk.http.HTTPRequest> value) Sets a callback that customizes the NimbusHTTPRequestfor each token request.httpTimeout(Duration value) Sets the connect/read timeout applied to each token request.Sets the RFC 8707resourceindicator (the canonical MCP server URI) sent on every token request.Adds requested OAuth scopes.tokenEndpoint(URI value) Sets the token endpoint URL.
-
Constructor Details
-
Builder
Constructor.- Parameters:
mode- The grant mode.
-
-
Method Details
-
tokenEndpoint
Sets the token endpoint URL. Required for the client-credentials and refresh-token modes.- Parameters:
value- The endpoint URL. Must not benull .- Returns:
- This object.
-
clientId
Sets the OAuth client ID. Required for the client-credentials and refresh-token modes.- Parameters:
value- The client ID. Must not benull or blank.- Returns:
- This object.
-
clientSecret
Sets the OAuth client secret as a literal string.- Parameters:
value- The client secret. Must not benull or blank.- Returns:
- This object.
-
clientSecretSupplier
Sets the OAuth client secret via a supplier.- Parameters:
value- The supplier. Must not benull .- Returns:
- This object.
-
scope
Adds requested OAuth scopes.- Parameters:
values- The scopes.- Returns:
- This object.
-
resource
Sets the RFC 8707resourceindicator (the canonical MCP server URI) sent on every token request.- Parameters:
value- The canonical resource URI. Must not benull .- Returns:
- This object.
-
expirySkew
Sets the skew subtracted from a cached token's expiry before it is treated as expired. Default 30s.- Parameters:
value- The skew. Must be non-negative.- Returns:
- This object.
-
clock
Sets the clock used for token-expiry comparisons. Primarily for tests.- Parameters:
value- The clock. Must not benull .- Returns:
- This object.
-
httpTimeout
Sets the connect/read timeout applied to each token request. Default 10 seconds.- Parameters:
value- The timeout. Must not benull and must be positive.- Returns:
- This object.
-
httpRequestConfigurator
public McpTokenProvider.Builder httpRequestConfigurator(Consumer<com.nimbusds.oauth2.sdk.http.HTTPRequest> value) Sets a callback that customizes the NimbusHTTPRequestfor each token request.- Parameters:
value- The callback. Must not benull .- Returns:
- This object.
-
build
Builds the provider.- Returns:
- A new
McpTokenProvider.
-