Class OidcTokens
java.lang.Object
com.codename1.io.oidc.OidcTokens
The tokens returned by an OpenID Connect token endpoint, with convenience accessors for the OIDC ID token claims. Immutable.
To bridge into the older AccessToken API used by Login,
call toAccessToken().
- Since:
- 8.0
-
Method Summary
Modifier and TypeMethodDescriptiondecodeIdTokenClaims(String compactJwt) Decodes the payload of a compact JWS without verifying the signature.static OidcTokensfromTokenResponse(Map<String, Object> json, String refreshTokenFallback) Builds anOidcTokensfrom a parsed JSON token-endpoint response, optionally merging in a refresh token from a previous response (token endpoints are allowed to omitrefresh_tokenon a refresh call).Convenience accessor for a single ID-token claim.getEmail()emailclaim from the ID token, when present.Absolute expiry instant, ornullif the token endpoint did not returnexpires_in.Read-only view of the ID token claims (empty if no ID token was returned).getName()nameclaim from the ID token, when present.The full, unmodified token-endpoint JSON.getScope()getStringClaim(String name) Convenience accessor for a string-valued claim.subclaim from the ID token -- the stable, opaque user identifier within the issuer.booleantrueifgetExpiresAt()is non-null and in the past.booleanisExpiringWithin(int leewaySeconds) Bridges into the legacyAccessTokenAPI used byLogin.
-
Method Details
-
fromTokenResponse
Builds anOidcTokensfrom a parsed JSON token-endpoint response, optionally merging in a refresh token from a previous response (token endpoints are allowed to omitrefresh_tokenon a refresh call). -
decodeIdTokenClaims
-
getAccessToken
-
getIdToken
-
getRefreshToken
-
getTokenType
-
getScope
-
getExpiresAt
Absolute expiry instant, ornullif the token endpoint did not returnexpires_in. -
isExpired
public boolean isExpired()trueifgetExpiresAt()is non-null and in the past. -
isExpiringWithin
public boolean isExpiringWithin(int leewaySeconds) trueifgetExpiresAt()is non-null and withinleewaySecondsof the current time. Pass a small leeway (60 -- 120 seconds) when deciding whether to refresh proactively. -
getIdTokenClaims
-
getClaim
-
getStringClaim
-
getRawResponse
-
getSubject
subclaim from the ID token -- the stable, opaque user identifier within the issuer. -
getEmail
emailclaim from the ID token, when present. -
getName
nameclaim from the ID token, when present. -
toAccessToken
Bridges into the legacyAccessTokenAPI used byLogin. The expiry is the absolute instant fromgetExpiresAt().
-