Package com.authlete.common.dto
Class Grant
- java.lang.Object
-
- com.authlete.common.dto.Grant
-
- All Implemented Interfaces:
Serializable
public class Grant extends Object implements Serializable
Grant.This class holds the same information as the response from the Grant Management Endpoint on the grant management action 'query' does.
- Since:
- 3.1
- See Also:
- Grant Management for OAuth 2.0, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Grant()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Grant
fromJson(String json)
Build aGrant
instance from a JSON string.AuthzDetails
getAuthorizationDetails()
Get the authorization details.String[]
getClaims()
Get the claims.GrantScope[]
getScopes()
Get the grant scopes.Grant
setAuthorizationDetails(AuthzDetails details)
Set the authorization details.Grant
setClaims(String[] claims)
Set the claimsGrant
setScopes(GrantScope[] scopes)
Set the grant scopes.String
toJson()
Convert this instance into a JSON string.
-
-
-
Method Detail
-
getScopes
public GrantScope[] getScopes()
Get the grant scopes.- Returns:
- The grant scopes.
-
setScopes
public Grant setScopes(GrantScope[] scopes)
Set the grant scopes.- Parameters:
scopes
- The grant scopes.- Returns:
this
object.
-
getClaims
public String[] getClaims()
Get the claims.- Returns:
- The claims
-
setClaims
public Grant setClaims(String[] claims)
Set the claims- Parameters:
claims
- The claims- Returns:
this
object.
-
getAuthorizationDetails
public AuthzDetails getAuthorizationDetails()
Get the authorization details.- Returns:
- The authorization details.
-
setAuthorizationDetails
public Grant setAuthorizationDetails(AuthzDetails details)
Set the authorization details.- Parameters:
details
- The authorization details.- Returns:
this
object.
-
toJson
public String toJson()
Convert this instance into a JSON string.The returned string contains a JSON object which has
"scopes"
,"claims"
and"authorization_details"
as top-level properties.- Returns:
- A JSON string.
-
fromJson
public static Grant fromJson(String json)
Build aGrant
instance from a JSON string.The following is an example of input JSON.
{ "scopes":[ { "scope":"contacts read write", "resource":[ "https://rs.example.com/api" ] }, { "scope":"openid" } ], "claims":[ "given_name", "nickname", "email", "email_verified" ], "authorization_details":[ { "type":"account_information", "actions":[ "list_accounts", "read_balances", "read_transactions" ], "locations":[ "https://example.com/accounts" ] } ] }
- Parameters:
json
- A JSON string.- Returns:
- A
Grant
instance built from the input JSON.
-
-