Skip to content

Commit 85ff32c

Browse files
Add token exchange support for organization applications and improve the existing docs
1 parent 0c384b1 commit 85ff32c

3 files changed

Lines changed: 55 additions & 11 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
{% set root_org_url = "https://localhost:9443/t/carbon.super" %}
2+
13
{% include "../../../../../includes/guides/organization-management/generate-tokens-for-organization-apps.md" %}

en/includes/guides/authentication/configure-token-exchange.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ After establishing account links, administrators can't delete them. Users can ma
130130
!!! note
131131
{{ product_name }} skips implicit account linking when **Require linked local account** is disabled, even if the implicit linking option remains enabled.
132132

133-
{% if product_name == "Asgardeo" %}
133+
{% if product_name == "Asgardeo" or (product_name == "WSO2 Identity Server" and is_version > "7.2.0") %}
134134

135135
To enable implicit account linking,
136136

@@ -150,20 +150,14 @@ To enable implicit account linking,
150150
!!! note
151151
If {{ product_name }} can't find a matching local user account using the primary lookup attribute, it searches for matching accounts using the secondary lookup attribute.
152152

153-
Following three attributes can be configured as lookup attributes
154-
155-
- `http://wso2.org/claims/username`
156-
- `http://wso2.org/claims/emailaddress`
157-
- `http://wso2.org/claims/mobile`
153+
By default, the `username` attribute is available as a lookup attribute. Administrators can make an attribute [unique across the user stores]({{base_path}}/guides/users/attributes/configure-unique-attributes), after which it will appear in the lookup attributes list.
158154

159155
{{ product_name }} will look for the <a href="{{base_path}}/guides/users/attributes/manage-oidc-attribute-mappings/#view-openid-connect-attributes">mapped OpenID Connect attribute</a> in the third-party token.
160156

161157
{% else %}
162158

163-
### Implicit account linking
164-
165-
In {{ product_name }}, implicit account linking can be configured via the
166-
[Implicit Association API](https://is.docs.wso2.com/en/{{ is_version }}/apis/idp/#tag/Implicit-Association/operation/updateImplicitAssociation).
159+
You can configure implicit account linking using the
160+
[Implicit Association API](https://is.docs.wso2.com/en/{{ is_version }}/apis/idp/#tag/Implicit-Association/operation/updateImplicitAssociation).
167161

168162
{% endif %}
169163

@@ -188,5 +182,9 @@ Follow the steps given below.
188182
!!! note
189183
{{ product_name }} only copies the `sub` claim from the token received from the trusted token issuer to the exchanged {{ product_name }} token.
190184

191-
Upon successful execution, you will receive the exchanged token issued by {{ product_name }}.
185+
{% if product_name == "Asgardeo" or (product_name == "WSO2 Identity Server" and is_version > "7.2.0") %}
186+
!!! note
187+
To learn how token exchange can be invoked in organization applications, see [Generate tokens for organization applications]({{base_path}}/guides/organization-management/generate-tokens-for-organization-apps).
188+
{% endif %}
192189

190+
Upon successful execution, you will receive the exchanged token.

en/includes/guides/organization-management/generate-tokens-for-organization-apps.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,50 @@ Use the following steps to use the client credentials to get an access token.
136136
}
137137
```
138138

139+
{% if product_name == "Asgardeo" or (product_name == "WSO2 Identity Server" and is_version > "7.2.0") %}
140+
141+
## Token exchange grant
142+
143+
Use the following request to exchange a subject token for an access token.
144+
145+
=== "Request format"
146+
147+
```bash
148+
curl --user <OAUTH_CLIENT_KEY>:<OAUTH_CLIENT_SECRET> -k
149+
-d "grant_type=urn:ietf:params:oauth:grant-type:token-exchange"
150+
-d "requested_token_type=urn:ietf:params:oauth:token-type:access_token"
151+
-d "subject_token_type=urn:ietf:params:oauth:token-type:jwt"
152+
-d "subject_token=<jwt_issued_from_a_trusted_token_issuer>"
153+
-d "scope=<desired scopes>"
154+
-H "Content-Type: application/x-www-form-urlencoded"
155+
{{ root_org_url }}/o/<ORG_ID>/oauth2/token
156+
```
157+
158+
=== "Sample request"
159+
160+
```bash
161+
curl --user fhErtAT2YF_M0Ek3AAYHLI8L25oa:JirxvtfoecnrS8vBjM7ygOtSIXuCS_uK_9WEC7d1zPEa -k
162+
-d "grant_type=urn:ietf:params:oauth:grant-type:token-exchange"
163+
-d "requested_token_type=urn:ietf:params:oauth:token-type:access_token"
164+
-d "subject_token_type=urn:ietf:params:oauth:token-type:jwt"
165+
-d "subject_token=<jwt_issued_from_a_trusted_token_issuer>"
166+
-d "scope=openid internal_org_user_mgt_list read_stores"
167+
-H "Content-Type: application/x-www-form-urlencoded"
168+
{{ root_org_url }}/o/12d1c4d2-2bb1-443b-aa4a-68f98a40d7c6/oauth2/token
169+
```
170+
171+
=== "Sample response"
172+
173+
```
174+
{
175+
"access_token": "bc978da1-6c56-3125-a999-a8d61c889672",
176+
"token_type": "Bearer",
177+
"expires_in": 3600
178+
}
179+
```
180+
181+
{% endif %}
182+
139183
!!! note
140184
If you need scopes in the response, add the `scope` parameter to the token request with the required scopes.
141185

0 commit comments

Comments
 (0)