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

public final class AccessTokenProviders

  1. Object
  2. AccessTokenProviders

Builds an AccessTokenProvider from configuration, so the credential lives in a secret store or the environment instead of in code.

Every key is under cn1.security.oauth2.client.credentials.<name>.:

keymeaning
grantclient_credentials, jwt_bearer or google_service_account
token-urithe token endpoint (not used by google_service_account)
client-idthe client id (client_credentials)
client-secretthe secret, sent as HTTP Basic unless client-authentication says post
client-authenticationbasic, post or private_key_jwt
key-filePEM private key: private_key_jwt, or the jwt_bearer signing key
key-idthe kid the key is registered under
issuer, subject, audiencejwt_bearer claims; audience is also sent by client_credentials
google-jsonpath of a Google service-account key file
scopesspace- or comma-separated scopes
scopes-in-assertionjwt_bearer: true sends the scopes as an assertion claim instead of a form parameter (false)
refresh-skewseconds before expiry a token stops being used (60)
max-backofflongest pause between failed exchanges, in seconds (60)
@Bean
AccessTokenProvider billing(Config config) throws IOException {
    return AccessTokenProviders.fromConfig(config, "billing");
}

Fields

public static final String PREFIX = "cn1.security.oauth2.client.credentials."The prefix of every key.

Methods

public static AccessTokenProvider fromConfig(Config config, String name) throws IOException

Inherited methods

Field details

PREFIX

public static final String PREFIX = "cn1.security.oauth2.client.credentials."
The prefix of every key.

Method details

fromConfig

public static AccessTokenProvider fromConfig(Config config, String name) throws IOException

Throws

IOException
when a file cannot be read or the configuration is incomplete; the message names the missing key, never a value