- Place the org.wso2.carbon.identity.oauth2.grant.jwt-1.0.0.jar downloded from store in the <IS_HOME>/repository/component/dropins directory.
To register the JWT grant type, configure the <IS_HOME>/repository/conf/identity/identity.xml file by adding a new entry under the <OAuth><SupportedGrantTypes> element. Add a unique identifier between the <GrantTypeName> tags as seen in the code block below.
- Restart the server.
Configure the JWT grant type
- Sign in to the WSO2 Identity Server. Enter your username and password to log on to the Management Console.
- In the Identity Providers section under the Main tab of the management console, click Add.
- Provide the following values to configure the IDP:
- Identity Provider Name: Enter a issuer name(which is used to generate the JWT assertion) as the IDP name.
Identity Provider Public Certificate: The certificate used to sign the JWT assertion.
- Alias: Give the name of the alias if the Identity Provider identifies this token endpoint by an alias. E.g., https://localhost:9443/oauth2/token
- Navigate to the Main menu to access the Identity menu. Click Add under Service Providers.
- Fill in the Service Provider Name and provide a brief Description of the service provider. See Adding a Service Provider for more information.
- Expand the OAuth/OpenID Connect Configuration and click Configure.
- Enter a callback url for example http://localhost:8080/playground2/oauth2client and click Add.
- The OAuth Client Key and OAuth Client Secret will now be visible.
The cURL commands below can be used to retrieve access token and refresh token using a JWT.
The -u flag should specify the “<Client Id>:<Client Secret>” value. The assertion parameter should specify the JWT assertion. Copy and paste the output value of the command line client. Make sure you have carefully copied and pasted the exact same value produced by the client; no more no less, since that value can be quite large.
If you have configured the service provider and identity provider in a tenant, you have to add the tenant domain as a query parameter to the access token endpoint.
If the tenant domain is wso2.com, access token endpoint will be as follows.
You would have now received the response from the token endpoint. The response would contain the access token, refresh token, expiry time and token type.