Package com.nimbusds.oauth2.sdk
Class TokenRequest.Builder
java.lang.Object
com.nimbusds.oauth2.sdk.TokenRequest.Builder
- Enclosing class:
- TokenRequest
Builder for constructing token requests.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilder
(URI endpoint, ClientAuthentication clientAuth, AuthorizationGrant authzGrant) Creates a new builder for a token request with client authentication.Builder
(URI endpoint, AuthorizationGrant authzGrant) Creates a new builder for a token request with no (explicit) client authentication, the client identifier is inferred from the authorisation grant.Builder
(URI endpoint, ClientID clientID, AuthorizationGrant authzGrant) Creates a new builder for a token request with no (explicit) client authentication. -
Method Summary
Modifier and TypeMethodDescriptionauthorizationDetails
(List<AuthorizationDetail> authorizationDetails) Sets the Rich Authorisation Request (RAR) details.build()
Builds a new token request.customParameter
(String name, String... values) Sets a custom parameter.deviceSecret
(DeviceSecret deviceSecret) Sets the device secret for native SSO.existingGrant
(RefreshToken existingGrant) Sets the existing refresh token for incremental authorisation of a public client.Sets the resource server URI.Sets the resource server URI(s).Sets the scope.
-
Constructor Details
-
Builder
Creates a new builder for a token request with client authentication.- Parameters:
endpoint
- The URI of the token endpoint. May benull
if theTokenRequest.toHTTPRequest()
method is not going to be used.clientAuth
- The client authentication. Must not benull
.authzGrant
- The authorisation grant. Must not benull
.
-
Builder
Creates a new builder for a token request with no (explicit) client authentication. The grant itself may be used to authenticate the client.- Parameters:
endpoint
- The URI of the token endpoint. May benull
if theTokenRequest.toHTTPRequest()
method is not going to be used.clientID
- The client identifier. Must not benull
.authzGrant
- The authorisation grant. Must not benull
.
-
Builder
Creates a new builder for a token request with no (explicit) client authentication, the client identifier is inferred from the authorisation grant.- Parameters:
endpoint
- The URI of the token endpoint. May benull
if theTokenRequest.toHTTPRequest()
method is not going to be used.authzGrant
- The authorisation grant. Must not benull
.
-
-
Method Details
-
scope
Sets the scope. Corresponds to the optionalscope
parameter.- Parameters:
scope
- The scope,null
if not specified.- Returns:
- This builder.
-
authorizationDetails
Sets the Rich Authorisation Request (RAR) details. Corresponds to the optionalauthorization_details
parameter.- Parameters:
authorizationDetails
- The authorisation details,null
if not specified.- Returns:
- This builder.
-
resource
Sets the resource server URI. Corresponds to the optionalresource
parameter.- Parameters:
resource
- The resource URI,null
if not specified.- Returns:
- This builder.
-
resources
Sets the resource server URI(s). Corresponds to the optionalresource
parameter.- Parameters:
resources
- The resource URI(s),null
if not specified.- Returns:
- This builder.
-
existingGrant
Sets the existing refresh token for incremental authorisation of a public client. Corresponds to the optionalexisting_grant
parameter.- Parameters:
existingGrant
- Existing refresh token for incremental authorisation of a public client,null
if not specified.- Returns:
- This builder.
-
deviceSecret
Sets the device secret for native SSO. Corresponds to the optionaldevice_secret
parameter.- Parameters:
deviceSecret
- The device secret,null
if not specified.- Returns:
- This builder.
-
customParameter
Sets a custom parameter.- Parameters:
name
- The parameter name. Must not benull
.values
- The parameter values,null
if not specified.- Returns:
- This builder.
-
build
Builds a new token request.- Returns:
- The token request.
-