@Immutable public class DeviceAuthorizationRequest extends AbstractOptionallyIdentifiedRequest
Extending classes may define additional request parameters as well as enforce tighter requirements on the base parameters.
Example HTTP request:
POST /device_authorization HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded client_id=459691054427
Related specifications:
Modifier and Type | Class | Description |
---|---|---|
static class |
DeviceAuthorizationRequest.Builder |
Builder for constructing authorisation requests.
|
Constructor | Description |
---|---|
DeviceAuthorizationRequest(URI uri,
ClientAuthentication clientAuth,
Scope scope,
Map<String,List<String>> customParams) |
Creates a new authenticated device authorization request with
extension and custom parameters.
|
DeviceAuthorizationRequest(URI uri,
ClientID clientID) |
Creates a new minimal device authorization request.
|
DeviceAuthorizationRequest(URI uri,
ClientID clientID,
Scope scope) |
Creates a new device authorization request.
|
DeviceAuthorizationRequest(URI uri,
ClientID clientID,
Scope scope,
Map<String,List<String>> customParams) |
Creates a new device authorization request with extension and custom
parameters.
|
Modifier and Type | Method | Description |
---|---|---|
List<String> |
getCustomParameter(String name) |
Returns the specified custom parameter.
|
Map<String,List<String>> |
getCustomParameters() |
Returns the additional custom parameters.
|
static Set<String> |
getRegisteredParameterNames() |
Returns the registered (standard) OAuth 2.0 device authorization
request parameter names.
|
Scope |
getScope() |
Gets the scope.
|
static DeviceAuthorizationRequest |
parse(HTTPRequest httpRequest) |
Parses an device authorization request from the specified HTTP
request.
|
HTTPRequest |
toHTTPRequest() |
Returns the matching HTTP request.
|
getClientAuthentication
getClientID
getEndpointURI
public DeviceAuthorizationRequest(URI uri, ClientID clientID)
uri
- The URI of the device authorization endpoint. May be
null
if the toHTTPRequest()
method
will not be used.clientID
- The client identifier. Corresponds to the
client_id
parameter. Must not be
null
.public DeviceAuthorizationRequest(URI uri, ClientID clientID, Scope scope)
uri
- The URI of the device authorization endpoint. May be
null
if the toHTTPRequest()
method
will not be used.clientID
- The client identifier. Corresponds to the
client_id
parameter. Must not be null
.scope
- The request scope. Corresponds to the optional
scope
parameter. null
if not
specified.public DeviceAuthorizationRequest(URI uri, ClientID clientID, Scope scope, Map<String,List<String>> customParams)
uri
- The URI of the device authorization endpoint.
May be null
if the toHTTPRequest()
method will not be used.clientID
- The client identifier. Corresponds to the
client_id
parameter. Must not be
null
.scope
- The request scope. Corresponds to the optional
scope
parameter. null
if not
specified.customParams
- Custom parameters, empty map or null
if
none.public DeviceAuthorizationRequest(URI uri, ClientAuthentication clientAuth, Scope scope, Map<String,List<String>> customParams)
uri
- The URI of the device authorization endpoint.
May be null
if the toHTTPRequest()
method will not be used.clientAuth
- The client authentication. Must not be
null
.scope
- The request scope. Corresponds to the optional
scope
parameter. null
if not
specified.customParams
- Custom parameters, empty map or null
if
none.public static Set<String> getRegisteredParameterNames()
public Scope getScope()
scope
parameter.null
if not specified.public Map<String,List<String>> getCustomParameters()
public List<String> getCustomParameter(String name)
name
- The parameter name. Must not be null
.null
if not specified.public HTTPRequest toHTTPRequest()
public static DeviceAuthorizationRequest parse(HTTPRequest httpRequest) throws ParseException
Example HTTP request (GET):
POST /device_authorization HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded client_id=459691054427
httpRequest
- The HTTP request. Must not be null
.ParseException
- If the HTTP request couldn't be parsed to an
device authorization request.Copyright © 2019 Connect2id Ltd.. All rights reserved.