Skip to content

Commit 5c31512

Browse files
committed
Add OAuth Token Hashing docs.
1 parent 376070e commit 5c31512

File tree

6 files changed

+89
-2
lines changed

6 files changed

+89
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% include "../../../../includes/references/token-hashing.md" %}

en/identity-server/7.1.0/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,7 @@ nav:
11631163
- Token binding:
11641164
- Token binding: references/token-binding/index.md
11651165
- Client-request: references/token-binding/client-request.md
1166+
- Token hashing: references/token-hashing.md
11661167
- Financial-grade API: references/financial-grade-api.md
11671168
- App-native authentication: references/app-native-authentication.md
11681169
- OIDC session management: references/concepts/oidc-session-management.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% include "../../../../includes/references/token-hashing.md" %}

en/identity-server/next/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1147,12 +1147,12 @@ nav:
11471147
- Token binding: references/token-binding/index.md
11481148
- Client-request: references/token-binding/client-request.md
11491149
- DPoP: references/token-binding/dpop.md
1150+
- Token hashing: references/token-hashing.md
11501151
- Financial-grade API: references/financial-grade-api.md
11511152
- App-native authentication: references/app-native-authentication.md
11521153
- OIDC session management: references/concepts/oidc-session-management.md
11531154
- Push Notification based authentication: references/concepts/push-notification-based-authentication.md
11541155

1155-
11561156
not_in_nav: |
11571157
/page-not-found.md
11581158
/guides/authentication/add-identifier-first-login.md

en/includes/guides/authorization/user-impersonation/user-impersonation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ To make an application discoverable,
224224
225225
3. Click **Update** to save the changes.
226226
227-
### Step 4: Share Application with Organization(Optional)
227+
### Step 6: Share Application with Organization(Optional)
228228
229229
To allow impersonating organization users, share the business applications with the relevant organization. Use the [documentation here]({{base_path}}/guides/organization-management/share-applications/#share-a-registered-application) to proceed with configuring.
230230
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# OAuth Token Hashing
2+
3+
WSO2 Identity Server (WSO2 IS) allows you to enable OAuth2 token hashing to protect OAuth2 access tokens, refresh tokens, consumer secrets, and
4+
authorization codes.
5+
6+
!!! note
7+
- Token hashing is only required if there are long lived tokens.
8+
9+
- If you want to enable this feature, WSO2 recommends using a fresh
10+
WSO2 Identity Server distribution.
11+
12+
- To use this feature with an existing database, you may need to
13+
perform data migration before you enable the feature. If you have to
14+
perform data migration before you enable this feature, [Contact
15+
us](https://wso2.com/contact/).
16+
17+
----
18+
19+
## Set up OAuth token hashing
20+
21+
1. Add the following configurations to the `deployment.toml` file found in the `<IS_HOME>/repository/conf` folder.
22+
- Add the following token persistence processor to enable token hashing:
23+
24+
``` toml
25+
[oauth.extensions]
26+
token_persistence_processor = "org.wso2.carbon.identity.oauth.tokenprocessor.HashingPersistenceProcessor"
27+
```
28+
29+
- Add the following property and set it to true to enable hashing.
30+
31+
``` toml
32+
[oauth]
33+
hash_tokens_and_secrets = true
34+
```
35+
36+
- Add the following configuration to specify the algorithm to use
37+
for hashing:
38+
39+
``` toml
40+
[oauth]
41+
hash_token_algorithm = "SHA-256"
42+
```
43+
44+
!!! tip
45+
WSO2 Identity Server allows you to use hashing algorithms supported by MessageDigest. For more information on hashing algorithms supported by MessageDigest, see [MessageDigest Algorithms](https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#MessageDigest).
46+
47+
The default algorithm for hashing is SHA-256.
48+
49+
2. Run the appropriate database command to remove the `CONN_APP_KEY` constraint from the `IDN_OAUTH2_ACCESS_TOKEN` table.
50+
51+
For example, if you are using an H2 database, you need to run the following command:
52+
53+
``` sql
54+
ALTER TABLE IDN_OAUTH2_ACCESS_TOKEN DROP CONSTRAINT IF EXISTS CON_APP_KEY
55+
```
56+
57+
!!! tip
58+
In general, for a specified consumer key, user, and scope, there can be only one active access token. The `CON_APP_KEY` constraint in the
59+
`IDN_OAUTH2_ACCESS_TOKEN` table enforces this by allowing only one active access token to exist for specified consumer key, user, and scope values.
60+
61+
With regard to hashing, a new access token is issued for every access token request. Therefore, for a given consumer key, user, and scope, there can be multiple active access tokens. To allow existence of multiple active access tokens, you need to remove the `CONN_APP_KEY` constraint from the `IDN_OAUTH2_ACCESS_TOKEN` table.
62+
63+
----
64+
65+
## Configure a service provider
66+
67+
Follow the steps below to register an application:
68+
69+
1. On the {{ product_name }} Console, go to **Applications**.
70+
71+
2. Click **New Application** and select **Standard-Based Application** to open the following:
72+
73+
![Register a standard based application]({{base_path}}/assets/img/apis/management-apis/register-a-sba.png){: width="600" style="display: block; margin: 0;"}
74+
75+
3. Provide an application name.
76+
77+
4. Select **OAuth 2.0 OpenID Connect** as the application protocol.
78+
79+
5. Click **Register** to complete the registration.
80+
81+
!!! tip
82+
The **Consumer Secret** value is displayed in plain text only once. Therefore, be sure to copy and save it for later use.
83+
84+
You have successfully set up OAuth token hashing. Now all of the OAuth2 access tokens, refresh tokens, consumer secrets, and authorization codes will be hashed in the database.

0 commit comments

Comments
 (0)