Package org.apache.juneau.rest.client.mcp.auth


package org.apache.juneau.rest.client.mcp.auth
Client-side OAuth 2.1 token acquisition for the Model Context Protocol 2026-07-28 revision.

This module supplies the token-provider implementations that plug into the McpAuthInterceptor seam of juneau-rest-client-mcp (its Supplier<String>). It deliberately does not depend on juneau-rest-server — the client-side flow/discovery helpers are relocated (see the flow and oidc sub-packages) rather than reused from juneau-rest-server-auth-oauth, which compile-depends on the server. A later auth-module de-layering is expected to rationalize this relocation.

What's here
  • McpTokenProvider — a Supplier<String> token manager for pre-provisioned (static) tokens, the client-credentials grant, and the refresh-token grant (SEP-2207, with rotated-refresh-token capture); all requests carry the RFC 8707 resource indicator.
  • McpProtectedResourceMetadataClient and WwwAuthenticateChallenge — the client half of the OAuth 2.1 baseline: consume a 401 WWW-Authenticate resource_metadata pointer, fetch the RFC 9728 PRM document, select an authorization server, and validate its issuer via RFC 8414 / OIDC discovery.
  • McpAuthorizationCodeAcquirer and LoopbackRedirectReceiver — interactive authorization-code + PKCE (S256) acquisition over a loopback redirect for headless/CLI use, including the SEP-2468 iss check on the callback.

Adoption-focused documentation for this module is intentionally tracked as a separate follow-up.

Since:
10.0.0