Class Grant

    • Constructor Detail

      • Grant

        public Grant()
    • 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 a Grant 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.