OAuth Token object reference
Access the OAuth Token object in Groovy policyCtx?.context.get("oauth_token")
.
Purpose
The OAuthToken object contains the OAuth access token and related identity attributes. The OAuthToken instance is available only for OAuth Groovy script rules.
Groovy sample
def scopes = policyCtx?.context.get("oauth_token")?.scopes
def attr = policyCtx?.context.get("oauth_token")?.attributes
def username = policyCtx?.context.get("oauth_token")?.attributes?.get("username")?.get(0)
exc?.request?.header?.add("x-scopes", "$scopes")
exc?.request?.header?.add("x-attributes", "$attr")
exc?.request?.header?.add("x-username", "$username")
pass()
Method summary
Method | Description |
---|---|
|
Contains the expiration instant of the OAuth access token. |
|
Contains the instant that the OAuth access token was retrieved from PingFederate. |
|
Contains the type of OAuth access token. (Bearer, JSON Web Token (JWT)). |
|
Contains the client ID associated with the OAuth access token. |
|
Contains the set of scopes associated with the OAuth access token. |
|
Contains a map of identity attributes specific to the user. |