Class ClientCredentialsGrant
java.lang.Object
com.codename1.backend.security.oauth2.client.credentials.ClientCredentialsGrant
- All Implemented Interfaces:
AccessTokenGrant
The OAuth2 client credentials grant (RFC 6749 section 4.4): this server authenticates as itself and receives a token for its own account.
AccessTokenProvider billing = new AccessTokenProvider(
ClientCredentialsGrant.builder("https://auth.example.com/oauth/token", "orders")
.clientSecret(config.get("billing.secret"))
.scopes("invoices:write")
.build());
Web.request("POST", url, Arrays.asList("Authorization: "
+ billing.getToken().toAuthorizationHeader()), body);
The client authenticates with a secret in an HTTP Basic header (the default,
client_secret_basic), with a secret in the form (client_secret_post), or
with a JWT signed by its own key (private_key_jwt, RFC 7523 section 2.2),
which sends no shared secret at all.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow the client proves who it is.static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringclient_assertion_typeof aprivate_key_jwtclient. -
Method Summary
-
Field Details
-
JWT_BEARER_ASSERTION_TYPE
client_assertion_typeof aprivate_key_jwtclient.- See Also:
-
-
Method Details
-
builder
- Parameters:
tokenUri- the authorization server's token endpointclientId- this server's client id there
-
fetch
Description copied from interface:AccessTokenGrantExchanges the credentials for a new token.- Specified by:
fetchin interfaceAccessTokenGrant
-
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-