Class OAuthClientCimdAwareService
- All Implemented Interfaces:
org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository
RegisteredClientRepository decorator that lazily resolves and
registers CIMD (Client ID Metadata Document) clients directly inside
findByClientId(String).
This is deliberately independent of Spring Security's internal filter chain /
filter ordering: since findByClientId is the exact method every
OAuth2 endpoint filter calls to resolve the client (authorization endpoint
validation, the main authorization endpoint, token endpoint client
authentication, introspection, etc.), performing the CIMD resolution here
means it works no matter which filter calls it, in what order, or how Spring
Security's internal filter wiring changes in future versions. This replaces
the previous approach of trying to run CIMD registration in an
AuthenticationProvider or a manually-ordered servlet Filter,
both of which depended on winning a race against the framework's own
client-lookup timing.
Marked Primary so this bean, not the plain
OAuthClientStorage, is the one wired into
OAuth2AuthorizationServerConfigurer. Direct injections of
OAuthClientStorage by its concrete type elsewhere in the codebase are
unaffected.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.oauth2.server.authorization.client.RegisteredClientfindByClientId(String clientId) org.springframework.security.oauth2.server.authorization.client.RegisteredClientvoidsave(org.springframework.security.oauth2.server.authorization.client.RegisteredClient registeredClient)
-
Constructor Details
-
OAuthClientCimdAwareService
public OAuthClientCimdAwareService()
-
-
Method Details
-
save
public void save(org.springframework.security.oauth2.server.authorization.client.RegisteredClient registeredClient) - Specified by:
savein interfaceorg.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository
-
findById
public org.springframework.security.oauth2.server.authorization.client.RegisteredClient findById(String id) - Specified by:
findByIdin interfaceorg.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository
-
findByClientId
public org.springframework.security.oauth2.server.authorization.client.RegisteredClient findByClientId(String clientId) - Specified by:
findByClientIdin interfaceorg.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository
-