Configuring a refresh token-to-ID-JAG token exchange
PingFederate can issue an Identity Assertion JWT Authorization Grant (ID-JAG) through OAuth token exchange when a client presents a refresh token as the subject token. Use this flow when PingFederate acts as the identity provider authorization server and must mint an ID-JAG for a downstream resource authorization server.
In this flow, the token exchange processor policy validates the inbound refresh token and makes attributes available for mapping. The OAuth Token Exchange SP connection identifies the downstream resource authorization server and defines how PingFederate issues the outbound ID-JAG.
Before you begin
Before you configure this flow, make sure that:
-
PingFederate is already issuing refresh tokens for the client that will request the ID-JAG.
-
You know the identifier of the resource authorization server that will consume the ID-JAG.
-
You have an existing OAuth client that will send the token exchange request.
|
This procedure uses a refresh token as the subject token because it represents an existing grant and is better suited for repeated or automated token exchanges without requiring reauthentication. Refresh tokens are also typically longer-lived than ID tokens. If your deployment uses an ID token as the subject token instead, use a JWT Token Processor 2.0 instance in the token exchange processor policy. Learn more in Configuring a JWT Token Processor 2.0 instance. |
Create a Refresh Token Token Processor instance
Use a Refresh Token Token Processor instance when the token exchange processor policy must accept a subject token of type urn:ietf:params:oauth:token-type:refresh_token. Learn more in Configuring a Refresh Token Token Processor instance.
|
If you expose grant attributes from the Refresh Token Token Processor, the extended contract attribute name must exactly match the persistent grant attribute name, including case. |
-
In the PingFederate admin console, go to Authentication > Token Exchange > Token Processors.
-
Click Create New Instance.
-
On the Type tab, enter an instance name and ID, and then select OAuth Refresh Token Token Processor as the type.
-
Go to the Instance Configuration tab. This plugin type has no individual configurable fields. Click Next.
-
On the Extended Contract tab, add any additional grant attributes you need to expose, and then click Next.
-
On the Token Attributes tab, optionally mask any attributes in log files, and then click Next.
-
Review the summary and click Save.
Define a token exchange processor policy
The token exchange processor policy controls how PingFederate validates the inbound refresh token and which attributes are passed to ID-JAG creation. Learn more in Defining token exchange processor policies.
-
Go to Applications > Token Exchange > Processor Policies.
-
Click Add Processor Policy.
-
On the Manage Processor Policy tab, enter the policy ID and name. If requests for this use case require both a subject token and an actor token, select Actor Token Required. Otherwise, leave it cleared. Click Next.
-
On the Attribute Contract tab, add contract attributes as needed, and then click Next.
-
On the Token Processor Mapping tab, click Map New Token Processor.
-
On the Token Types tab, in the Subject Token Processor list, select the Refresh Token Token Processor instance.
The Subject Token Type field populates with
urn:ietf:params:oauth:token-type:refresh_token.If your use case requires an actor token, also select the actor token processor and enter the actor token type. Click Next.
-
On the Attribute Sources & User Lookup tab, add additional attribute sources if needed, and then click Next.
-
On the Contract Fulfillment tab, map each contract attribute to a source and value, and then click Next.
-
On the Issuance Criteria tab, define any conditions that must be satisfied before PingFederate exchanges the token, and then click Next.
-
Review the mapping summary, click Done, review the policy summary, and then click Done.
-
Click Save.
-
(Optional) Set the new policy as the default processor policy.
Configure the OAuth Token Exchange SP connection
Configure an OAuth Token Exchange SP connection to issue the ID-JAG to the downstream resource authorization server.
-
Go to Applications > Integration > SP Connections.
-
Click Create Connection.
-
On the Connection Template page, select Do Not Use A Template For This Connection or select a template. Click Next.
-
On the Connection Type page, select OAuth Token Exchange, and then click Next.
-
On the General Info page, configure the identifying information for the connection. Set Partner’s Entity ID to the resource authorization server base URL. Click Next.
-
On the OAuth Token Exchange page, click Configure OAuth Token Exchange.
-
On the Protocol Settings page, if the client includes a
resourceparameter in the token exchange request, configure the corresponding resource URIs so PingFederate can select the correct OAuth Token Exchange SP connection. If the request targets multiple resources, add each applicable resource URI.In this flow, the
resourceparameter helps PingFederate select the SP connection for the token exchange request. Use theaudienceparameter to identify the intended audience for the issued ID-JAG. Partner’s Entity ID becomes the defaultaudclaim if no audience is provided. -
In Allowed Requested Token Types, select Identity Assertion JWT (ID-JAG).
-
Click Next.
-
On the Token Lifetime page, optionally override the token lifetime settings, and then click Next.
-
Click Configure Token Creation.
-
On the Attribute Contract page, optionally extend the contract with any additional attributes that you need in the issued token, and then click Next.
-
On the Processor Policy Mapping page, click Map Processor Policy Instance.
-
In the Processor Policy Instance list, select the token exchange processor policy instance, and then click Next.
-
On the Attribute Retrieval page, choose whether to use only the attributes in the incoming token or to use the incoming token to look up additional information.
-
On the Attribute Contract Fulfillment page, map the contract attributes required for the ID-JAG.
-
(Optional) Define issuance criteria for the token exchange.
-
On the Summary tab, review the token creation summary, click Done, complete the remaining SP connection tasks, configure credentials, and then save the connection.
Issued ID-JAG tokens use the
typheader valueoauth-id-jag+jwt. By default, theaudclaim in the issued JSON Web Token (JWT) is set to the Partner’s Entity ID value.
Learn more in Configuring SP connections for OAuth token exchange.
Enable token exchange in the OAuth client
Enable the token exchange grant in the OAuth client that will send the token exchange request.
-
Go to Applications > OAuth > Clients.
-
Open the client that will send the token exchange request.
-
In Allowed Grant Types, select Token Exchange.
-
In the Token Exchange section, select the token exchange processor policy.
-
Click Save.
Learn more in Enabling token exchange in OAuth clients.
Verify the token exchange request
After you complete the configuration, the client can request an ID-JAG by sending a token exchange request to the token endpoint.
Example:
Example token exchange request:
POST /oauth2/token HTTP/1.1
Host: acme.idp.example
Content-Type: application/x-www-form-urlencoded
grant_type=urn:ietf:params:oauth:grant-type:token-exchange
&requested_token_type=urn:ietf:params:oauth:token-type:id-jag
&audience=https://acme.chat.example/
&resource=https://api.chat.example/
&scope=chat.read+chat.history
&subject_token=h4X9fK2mN1vP7zQ8wB3r...
&subject_token_type=urn:ietf:params:oauth:token-type:refresh_token
If the request succeeds, PingFederate returns the ID-JAG in the access_token field and identifies the issued token type as urn:ietf:params:oauth:token-type:id-jag.
Example token exchange response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsI...",
"issued_token_type": "urn:ietf:params:oauth:token-type:id-jag",
"token_type": "N_A",
"expires_in": 300
}
Next steps
If the client uses the issued ID-JAG to request an access token from a resource authorization server, configure that resource authorization server to accept the ID-JAG as a JWT bearer assertion. Learn more in JWT Bearer Grant Processors.