Find User Consent's
get
/oauth2/rest/consent
The REST API enables End User to fetch consents. The API return's all the consents for a given User or specific consents for a given User, OAuth Client and OAuth Application combination.
Request
Supported Media Types
- application/x-www-form-urlencoded
Query Parameters
-
clientIdentifier: string
OAuth Client ID/Identifier
-
identityDomain: string
Identity Domain under which the token is being requested. This is an optional parameter if 'x-oauth-identity-domain-name' header parameter is provided.
-
resServerId: string
OAuth Application ID/Identifier
Header Parameters
-
oam_remote_user(required): string
Specify User name/identifier (either via oam_remote_user (header) or oam_id (cookie)) who's consents needs to be retrieved.
-
x-oauth-identity-domain-name(required): string
OAuth Identity Domain name under which user consents are expected.
Response
Supported Media Types
- application/json
200 Response
Sucessfully retrieved user consent - detail
Nested Schema : consent
Type:
Show Source
object
-
clientId(required):
string
OAuth Client Identifier
-
consentId(required):
string
OAuth Consent Unique Identifier
-
createTimeStamp(required):
string
Creation timestamp for OAuth Consent
-
resourceId(required):
string
OAuth Application Identifier
-
scopes(required):
array scope
-
valid(required):
boolean
Flag to identify OAuth Consent validity. True - Consent is valid, False - Consent is In-valid
400 Response
Failed to retrieve user consent - detail
Root Schema : schema
Type:
Show Source
object
-
error:
string
Error code
-
error_description:
string
Error description
Example:
{
"error":"400",
"error_description":"Required parameter 'X-OAUTH-IDENTITY-DOMAIN-NAME' is not present."
}
Examples
The following example shows a sample request and response to fetch all the consents for a specific user, under an OAuth Identity Domain Name.
cURL Example to Fetch All the Consents
curl --location --request GET 'http://<lbr-host>:<lbr-port>/oauth2/rest/consent' \ --header 'X-OAUTH-IDENTITY-DOMAIN-NAME: DemoDomain' \ --header 'OAM_REMOTE_USER: DemoUser'
Sample Response
{ "consents": [ { "consentId": "ebe683b9-0345-3c35-a21d-35e57958ed21", "clientId": "DemoClient", "resourceId": "506a50c2-a892-49ee-85ad-9993169a18bf", "scopes": [ "DemoResource.editDemoRes", "DemoResource.delDemoRes", "DemoResource.viewDemoRes" ], "additionalScopes": null, "createTimeStamp": "Wed Apr 08 23:06:54 PDT 2020", "valid": true }, { "consentId": "8c1d5d3a-dc74-3939-aa72-03c12fcff3b3", "clientId": "DemoClient", "resourceId": "OPENID_MGMT_RESOURCE", "scopes": [ "openid", "profile", "email" ], "additionalScopes": null, "createTimeStamp": "Wed Apr 08 23:06:54 PDT 2020", "valid": true } ] }
The following example shows a sample request and response to fetch consents for each user and client-application.
cURL Command to Fetch Consents for Each User and Client-Application
curl --location --request GET 'https://<lbr-host>:<lbr-port>/oauth2/rest/consent?resServerId=506a50c2-a892-49ee-85ad-9993169a18bf&clientIdentifier=DemoClient' \ --header 'X-OAUTH-IDENTITY-DOMAIN-NAME: DemoDomain' \ --header 'OAM_REMOTE_USER: DemoUser'
Sample Response
{ "consents": [ { "consentId": "ebe683b9-0345-3c35-a21d-35e57958ed21", "clientId": "DemoClient", "resourceId": "506a50c2-a892-49ee-85ad-9993169a18bf", "scopes": [ "DemoResource.editDemoRes", "DemoResource.delDemoRes", "DemoResource.viewDemoRes" ], "additionalScopes": null, "createTimeStamp": "Wed Apr 08 23:06:54 PDT 2020", "valid": true } ] }