Class TokenSettings

java.lang.Object
com.codename1.backend.security.oauth2.server.authorization.TokenSettings

public final class TokenSettings extends Object

How long what is issued to one client lasts, in seconds.

Unless set
authorization code 5 minutes
access token 5 minutes
ID token 30 minutes
refresh token 60 minutes from its last use
device code 5 minutes

A refresh token is replaced every time it is used unless isReuseRefreshTokens() says otherwise, and using one that was replaced revokes the whole grant.

  • Method Details

    • builder

      public static TokenSettings.Builder builder()
    • getAuthorizationCodeTimeToLive

      public long getAuthorizationCodeTimeToLive()
    • getAccessTokenTimeToLive

      public long getAccessTokenTimeToLive()
    • getIdTokenTimeToLive

      public long getIdTokenTimeToLive()
    • getRefreshTokenTimeToLive

      public long getRefreshTokenTimeToLive()
    • getDeviceCodeTimeToLive

      public long getDeviceCodeTimeToLive()
    • isReuseRefreshTokens

      public boolean isReuseRefreshTokens()
      Whether a refresh token stays the same when it is used. False unless set: a token that is replaced on every use lets a stolen one be noticed.
    • isReferenceAccessTokens

      public boolean isReferenceAccessTokens()
      Builds a TokenSettings. Every time is in seconds, and positive. Whether the client's access tokens are opaque references rather than signed JWTs. A resource server learns what an opaque token grants only by asking the introspection endpoint, so a revoked grant stops working at once everywhere and the token's claims never leave this server; the price is a call per token (or per cache period) at the resource server. False unless set.
    • isX509CertificateBoundAccessTokens

      public boolean isX509CertificateBoundAccessTokens()
      Whether the client's access tokens are bound to the TLS client certificate it requested them with (RFC 8705 section 3): they carry its thumbprint in cnf.x5t#S256, a resource server accepts them only over a connection authenticated with that certificate, and a token request without a certificate is refused. False unless set.