Token introspection lets a resource server ask an authorization server whether an access token is valid and retrieve the client and user details needed for authorization. It is primarily used with opaque tokens, which contain no authorization data themselves. section 13.2 section 13.2.1
An introspection-based request follows this sequence:
- Register the resource server as a client at the authorization server and provide client credentials. section 15.3
- Configure the resource server with the introspection endpoint, client ID, and client secret. section 15.3
- Send the token to the authorization server using an authenticated introspection request. section 14.4
- Use the response to accept or reject the request and apply authorization constraints; valid responses report active true, while expired or unknown tokens report active false. section 13.2.1 section 14.4
Configure a Spring Security resource server
Set the introspection URI and resource-server credentials as external properties, then configure Spring Security with `oauth2ResourceServer().opaqueToken()`. Supply `introspectionUri` and `introspectionClientCredentials(...)`, and require authentication with `anyRequest().authenticated()`. Obtain an opaque access token from the authorization server, call the protected `/demo` endpoint with a Bearer token, and use the response to verify the setup.
Figure 15.6 Token introspection. In situations where the resource server cannot depend on signature-based validation of access tokens (such as when token revocation is necessary), or when the token does not contain detailed information (as with opaque tokens), the resource server is required to make inquiries to the authorization server. This is done to ascertain the validity of a token and to gather additional information about it.
Trace how the resource server queries the authorization server when opaque tokens lack local details or early revocation must be supported. section 15.3


