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 (draft-ietf-oauth-device-flow-15)
-
-
Field Summary
Fields Modifier and Type Field Description static GrantTypeGRANT_TYPEThe 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 booleanequals(Object o)DeviceCodegetDeviceCode()Returns the device code received from the authorisation server.inthashCode()static DeviceCodeGrantparse(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:AuthorizationGrantReturns the request body parameters for the authorisation grant.- Specified by:
toParametersin 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.
-
-