Class RemoteOpaqueTokenIntrospector
java.lang.Object
com.codename1.backend.security.oauth2.server.resource.RemoteOpaqueTokenIntrospector
- All Implemented Interfaces:
OpaqueTokenIntrospector
Introspects tokens at an authorization server's RFC 7662 endpoint, as a
client of it: with a secret (client_secret_basic) or with a JWT signed
by a private key (private_key_jwt).
http.oauth2ResourceServer(rs -> rs.opaqueToken(o -> o
.introspectionUri("https://auth.example.com/oauth2/introspect")
.introspectionClientCredentials("orders-api", secret)));
Every request with a token costs a call to the endpoint unless answers are
cached with setCacheSeconds(long). A cached answer outlives a revocation by
up to that long, which is the trade being made; it never outlives the
token's own exp.
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteOpaqueTokenIntrospector(String introspectionUri, String clientId, String clientSecret) Authenticates to the endpoint with HTTP Basic. -
Method Summary
Modifier and TypeMethodDescriptionintrospect(String token) The claims of an active token:sub,scope,client_id,expand whatever else the authorization server answers, withoutactive.voidsetCacheSeconds(long seconds) How long an active answer is reused; 0, the default, asks every time.voidvoidsetTransport(TokenEndpoint.Transport transport) Where the requests go;TokenEndpoint.WEBunless set.withPrivateKeyJwt(String introspectionUri, String clientId, Jwk privateKey) Authenticates to the endpoint withprivate_key_jwt: each call signs a fresh assertion addressed to the endpoint.
-
Constructor Details
-
RemoteOpaqueTokenIntrospector
-
-
Method Details
-
withPrivateKeyJwt
public static RemoteOpaqueTokenIntrospector withPrivateKeyJwt(String introspectionUri, String clientId, Jwk privateKey) Authenticates to the endpoint withprivate_key_jwt: each call signs a fresh assertion addressed to the endpoint. -
setTransport
Where the requests go;TokenEndpoint.WEBunless set. -
setClock
-
setCacheSeconds
public void setCacheSeconds(long seconds) How long an active answer is reused; 0, the default, asks every time. -
introspect
Description copied from interface:OpaqueTokenIntrospectorThe claims of an active token:sub,scope,client_id,expand whatever else the authorization server answers, withoutactive.- Specified by:
introspectin interfaceOpaqueTokenIntrospector
-