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 benullif 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 benullif 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 benullif 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 optionalscopeparameter.- Parameters:
scope- The scope,nullif not specified.- Returns:
- This builder.
-
authorizationDetails
Sets the Rich Authorisation Request (RAR) details. Corresponds to the optionalauthorization_detailsparameter.- Parameters:
authorizationDetails- The authorisation details,nullif not specified.- Returns:
- This builder.
-
resource
Sets the resource server URI. Corresponds to the optionalresourceparameter.- Parameters:
resource- The resource URI,nullif not specified.- Returns:
- This builder.
-
resources
Sets the resource server URI(s). Corresponds to the optionalresourceparameter.- Parameters:
resources- The resource URI(s),nullif not specified.- Returns:
- This builder.
-
existingGrant
Sets the existing refresh token for incremental authorisation of a public client. Corresponds to the optionalexisting_grantparameter.- Parameters:
existingGrant- Existing refresh token for incremental authorisation of a public client,nullif not specified.- Returns:
- This builder.
-
deviceSecret
Sets the device secret for native SSO. Corresponds to the optionaldevice_secretparameter.- Parameters:
deviceSecret- The device secret,nullif not specified.- Returns:
- This builder.
-
customParameter
Sets a custom parameter.- Parameters:
name- The parameter name. Must not benull.values- The parameter values,nullif not specified.- Returns:
- This builder.
-
build
Builds a new token request.- Returns:
- The token request.
-