Package com.nimbusds.oauth2.sdk
Class ResourceOwnerPasswordCredentialsGrant
java.lang.Object
com.nimbusds.oauth2.sdk.AuthorizationGrant
com.nimbusds.oauth2.sdk.ResourceOwnerPasswordCredentialsGrant
Resource owner password credentials grant. Used in access token requests
with the resource owner's username and password.
Related specifications:
- OAuth 2.0 (RFC 6749)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionResourceOwnerPasswordCredentialsGrant(String username, Secret password) Creates a new resource owner password credentials grant. -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the resource owner's password.Gets the resource owner's username.inthashCode()Parses a resource owner password credentials grant from the specified request body parameters.Returns the request body parameters for the authorisation grant.Methods inherited from class com.nimbusds.oauth2.sdk.AuthorizationGrant
getType
-
Field Details
-
GRANT_TYPE
The grant type.
-
-
Constructor Details
-
ResourceOwnerPasswordCredentialsGrant
Creates a new resource owner password credentials grant.- Parameters:
username- The resource owner's username. Must not benull.password- The resource owner's password. Must not benull.
-
-
Method Details
-
getUsername
Gets the resource owner's username.- Returns:
- The username.
-
getPassword
Gets the resource owner's password.- Returns:
- The password.
-
toParameters
Description copied from class:AuthorizationGrantReturns the request body parameters for the authorisation grant.- Specified by:
toParametersin classAuthorizationGrant- Returns:
- The parameters.
-
equals
-
hashCode
-
parse
public static ResourceOwnerPasswordCredentialsGrant parse(Map<String, List<String>> params) throws ParseExceptionParses a resource owner password credentials grant from the specified request body parameters.Example:
grant_type=password username=johndoe password=A3ddj3w
- Parameters:
params- The parameters.- Returns:
- The resource owner password credentials grant.
- Throws:
ParseException- If parsing failed.
-