Repository navigation
v26.6.33
Spring Security parity — Tier 4: the OAuth2 ecosystem. The wider OAuth2
surface beyond the browser login flow. All additive (no behaviour change to
existing code). Adversarially reviewed before release.
Added
- Opaque-token introspection (RFC 7662) —
RemoteTokenIntrospector
(Spring'sOpaqueTokenIntrospector): POSTs a non-JWT bearer token to the
authorization server's introspection endpoint (HTTP Basic client auth) and,
onactive: true, maps the response to anAuthentication. Implements
Verifier, so it drops into aBearerLayeras an alternative to local JWT
verification. Fails closed (transport error / non-2xx / non-JSON /
active: false/absent all reject). - Outbound OAuth2 client (
AuthorizedClientManager) —
OAuth2AuthorizedClientManager+OAuth2AuthorizedClientService(+
InMemoryOAuth2AuthorizedClientService) obtain, cache, and auto-refresh the
access tokens the app needs to call downstream services: the client-credentials
grant (service-to-service) and the refresh-token grant, reusing a cached
OAuth2AuthorizedClientuntil it is within the clock-skew window of expiry. - RP-initiated logout (OIDC) —
oidc_logout_url+ClientRegistration's new
end_session_endpoint/post_logout_redirect_uri:POST /logoutinvalidates
the local session and, when the provider advertises anend_session_endpoint,
redirects to it withid_token_hint+post_logout_redirect_uri(Spring's
OidcClientInitiatedLogoutSuccessHandler). The login callback now stores the
registration_id+id_tokenfor the hint. - Authorization-server HTTP endpoints —
AuthorizationServerRoutermounts
the previously callable-onlyAuthorizationServerasPOST /oauth2/token
(RFC 6749; client-credentials + refresh-token,client_secret_post; RFC 6749
§5.2 error envelope) andGET /.well-known/oauth-authorization-server(RFC 8414
metadata).
Security notes & known limitations (roadmap)
- The OAuth2 HTTP clients (introspection, outbound token, JWKS, login) now apply
connect/read timeouts and cap the response body, so a slow or hostile endpoint
cannot hang the bearer-verification path or force unbounded allocation; a token
response with noexpires_inis assumed short-lived (bounded fallback), never
immortal.ClientRegistrationandOAuth2AuthorizedClientredact their
secrets/tokens inDebug. - The authorization server signs HS256 (symmetric), so no
jwks_uriis
published; the server-side authorization_code grant + PKCE, an/authorize
endpoint, and a client-authenticated/oauth2/revoke(RFC 7009) remain a
follow-up. OAuth2AuthorizedClientManagerdoes not single-flight concurrent
authorizations for the same registration: concurrent callers may each hit the
token endpoint, and against an authorization server that rotates refresh
tokens, concurrent refreshes can lose a rotated token (last-writer-wins).
Serialize refreshes for the same client if your AS rotates. Token-endpoint
failures surface as the HTTP status (the structured RFC 6749 §5.2 error body is
not yet parsed back).