Package com.nimbusds.oauth2.sdk.device
Class DeviceCodeGrant
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.AuthorizationGrant
-
- com.nimbusds.oauth2.sdk.device.DeviceCodeGrant
-
@Immutable public class DeviceCodeGrant extends AuthorizationGrant
Device code grant for the OAuth 2.0 Device Authorization Grant.Related specifications:
- OAuth 2.0 Device Authorization Grant (RFC 8628)
-
-
Field Summary
Fields Modifier and Type Field Description static GrantType
GRANT_TYPE
The grant type.
-
Constructor Summary
Constructors Constructor Description DeviceCodeGrant(DeviceCode deviceCode)
Creates a new device code grant.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
DeviceCode
getDeviceCode()
Returns the device code received from the authorisation server.int
hashCode()
static DeviceCodeGrant
parse(Map<String,List<String>> params)
Parses a device code grant from the specified request body parameters.Map<String,List<String>>
toParameters()
Returns the request body parameters for the authorisation grant.-
Methods inherited from class com.nimbusds.oauth2.sdk.AuthorizationGrant
getType
-
-
-
-
Field Detail
-
GRANT_TYPE
public static final GrantType GRANT_TYPE
The grant type.
-
-
Constructor Detail
-
DeviceCodeGrant
public DeviceCodeGrant(DeviceCode deviceCode)
Creates a new device code grant.- Parameters:
deviceCode
- The device code. Must not benull
.
-
-
Method Detail
-
getDeviceCode
public DeviceCode getDeviceCode()
Returns the device code received from the authorisation server.- Returns:
- The device code received from the authorisation server.
-
toParameters
public Map<String,List<String>> toParameters()
Description copied from class:AuthorizationGrant
Returns the request body parameters for the authorisation grant.- Specified by:
toParameters
in classAuthorizationGrant
- Returns:
- The parameters.
-
parse
public static DeviceCodeGrant parse(Map<String,List<String>> params) throws ParseException
Parses a device code grant from the specified request body parameters.Example:
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code &device_code=GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS
- Parameters:
params
- The parameters.- Returns:
- The device code grant.
- Throws:
ParseException
- If parsing failed.
-
-