Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class AccessTokenProviders
- Object
- 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>.:
| key | meaning |
|---|---|
grant | client_credentials, jwt_bearer or google_service_account |
token-uri | the token endpoint (not used by google_service_account) |
client-id | the client id (client_credentials) |
client-secret | the secret, sent as HTTP Basic unless client-authentication says post |
client-authentication | basic, post or private_key_jwt |
key-file | PEM private key: private_key_jwt, or the jwt_bearer signing key |
key-id | the kid the key is registered under |
issuer, subject, audience | jwt_bearer claims; audience is also sent by client_credentials |
google-json | path of a Google service-account key file |
scopes | space- or comma-separated scopes |
scopes-in-assertion | jwt_bearer: true sends the scopes as an assertion claim instead of a form parameter (false) |
refresh-skew | seconds before expiry a token stops being used (60) |
max-backoff | longest 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 IOExceptionThrows
IOException- when a file cannot be read or the configuration is incomplete; the message names the missing key, never a value