Class McpProtectedResourceMetadataClient.Builder
java.lang.Object
org.apache.juneau.rest.client.mcp.auth.McpProtectedResourceMetadataClient.Builder
- Enclosing class:
- McpProtectedResourceMetadataClient
Builder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowInsecureHttp(boolean value) Allows plainhttpPRM / authorization-server URLs for non-loopback hosts.allowPrivateUrls(boolean value) Allows PRM / authorization-server URLs that point at loopback, private, link-local or metadata hosts.build()Builds the client.expectedResource(URI value) Sets the expectedresourceidentifier the PRM document'sresourcefield is validated against (RFC 9728 §3.3).httpRequestConfigurator(Consumer<com.nimbusds.oauth2.sdk.http.HTTPRequest> value) Sets a callback that customizes the NimbusHTTPRequestused for the PRM fetch and AS discovery.httpTimeout(Duration value) Sets the connect/read timeout applied to the PRM fetch and AS discovery.skipResourceValidation(boolean value) Skips the check of the PRMresourcefield against an expected resource identifier.
-
Constructor Details
-
Builder
protected Builder()Constructor.
-
-
Method Details
-
expectedResource
Sets the expectedresourceidentifier the PRM document'sresourcefield is validated against (RFC 9728 §3.3).This is the canonical URI of the MCP server the client was actually talking to. A per-call value passed to
McpProtectedResourceMetadataClient.fetch(URI, URI)/McpProtectedResourceMetadataClient.parse(String, URI, URI)overrides this.- Parameters:
value- The expected resource identifier. Must not benull .- Returns:
- This object.
-
httpTimeout
Sets the connect/read timeout applied to the PRM fetch and AS discovery. Default 10 seconds.- Parameters:
value- The timeout. Must not benull and must be positive.- Returns:
- This object.
-
allowPrivateUrls
Allows PRM / authorization-server URLs that point at loopback, private, link-local or metadata hosts.Intended for local development and testing. Also permits plain
httpfor loopback hosts.- Parameters:
value-true to skip the host deny-list.- Returns:
- This object.
-
skipResourceValidation
Skips the check of the PRMresourcefield against an expected resource identifier.By default an expected resource is required.
- Parameters:
value-true to skip the resource identity check.- Returns:
- This object.
-
allowInsecureHttp
Allows plainhttpPRM / authorization-server URLs for non-loopback hosts.- Parameters:
value-true to skip thehttpsscheme check.- Returns:
- This object.
-
httpRequestConfigurator
public McpProtectedResourceMetadataClient.Builder httpRequestConfigurator(Consumer<com.nimbusds.oauth2.sdk.http.HTTPRequest> value) Sets a callback that customizes the NimbusHTTPRequestused for the PRM fetch and AS discovery.- Parameters:
value- The callback. Must not benull .- Returns:
- This object.
-
build
Builds the client.- Returns:
- A new
McpProtectedResourceMetadataClient.
-