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

public interface OAuth2TokenValidator<T>

Known subtypesDelegatingOAuth2TokenValidator, JwtAudienceValidator, JwtClaimValidator, JwtIssuerValidator, JwtTimestampValidator, OAuth2AuthorizationValidator

One check a token is put to after its signature has verified: is it still in date, is it from the issuer this server trusts, is it meant for this server.

OAuth2TokenValidator<Jwt> tenant = jwt -> "acme".equals(jwt.getClaimAsString("tenant"))
        ? OAuth2TokenValidatorResult.success()
        : OAuth2TokenValidatorResult.failure(new OAuth2Error("invalid_token",
                "The token is for another tenant", null));

Methods

public abstract OAuth2TokenValidatorResult validate(T token)Whether token passes, and why not.

Method details

validate

public abstract OAuth2TokenValidatorResult validate(T token)
Whether token passes, and why not.