Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class JwtTimestampValidator

  1. Object
  2. JwtTimestampValidator

ImplementsOAuth2TokenValidator<Jwt>

Refuses a token past its exp or ahead of its nbf, with a minute’s allowance either way for two machines whose clocks disagree.

A token with neither claim passes: whether a token must expire is for the issuer to decide and for another validator to demand.

Constructors

public JwtTimestampValidator()With the allowance of 60 seconds.
public JwtTimestampValidator(long clockSkewSeconds)

Methods

public void setClock(Clock clock)Reads the time from clock instead of the machine.
public OAuth2TokenValidatorResult validate(Jwt jwt)Whether token passes, and why not.

Inherited methods

Constructor details

JwtTimestampValidator

public JwtTimestampValidator()
With the allowance of 60 seconds.

JwtTimestampValidator

public JwtTimestampValidator(long clockSkewSeconds)

Parameters

clockSkewSeconds long
how far past exp or ahead of nbf still passes

Method details

setClock

public void setClock(Clock clock)
Reads the time from clock instead of the machine.

validate

public OAuth2TokenValidatorResult validate(Jwt jwt)
Whether token passes, and why not.