OAuth 2.0 has three main phases. They are; requesting an Authorization Grant, exchanging the Authorization Grant for an Access Token and accessing the resources using this Access Token. OpenID Connect is another identity layer on top of OAuth 2.0. OAuth applications can get authentication event information over the IDToken and can get the extra claims of the authenticated user from the OpenID Connect UserInfo endpoint.
To enable OAuth support for your client application, you must first register your application by providing an application name. For code and implicit grant types, you have to provide a callback URL. Follow the instructions below to add a new application.
Let's get started to configure the service provider you created.
Expand the OAuth/OpenID Connect Configuration and click Configure.
Fill in the form that appears. For the Allowed Grant Types you can disable the ones you do not require or wish to block.
Note: The grant type highlighted below is a custom grant type. This will only appear on the UI if you have configured the JWT grant type. The value specified in the
<GrantTypeName>
property of theidentity.xml
file when creating the custom grant type is the value that will appear on the UI. For more information on writing a custom grant type, see Writing a Custom OAuth 2.0 Grant Type.- Click Add. The following information is added for your service provider.
- OAuth Client Key - This is the client key of the service provider, which will be checked for authentication by the Identity Server before providing the access token.
- OAuth Client Secret - This is the client secret of the service provider, which will be checked for authentication by the Identity Server before providing the access token. Click the Show button to view the exact value of this.
- Actions -
Edit: Click to edit the OAuth/OpenID Connect Configurations
Revoke: Click to revoke (deactivate) the OAuth application. This action revokes all tokens issued for this application. In order to activate the application, you have to regenerate the consumer secret.
Regenerate Secret: Click to regenerate the secret key of the OAuth application.
Delete: Click to delete the OAuth/OpenID Connect Configurations
Tip: The OAuth client key and client secret are stored in plain text. To encrypt the client secret, access token and refresh token, do the following:
Open the
identity.xml
file found in the<IS_HOME>/repository/conf/identity
directory and change the<TokenPersistenceProcessor>
property as follows:<TokenPersistenceProcessor>org.wso2.carbon.identity.oauth.tokenprocessor.EncryptionDecryptionPersistenceProcessor</TokenPersistenceProcessor>
After updating the configuration, make sure to restart the server for the changes to be applied on WSO2 Identity Server.
See Configuring OpenID Connect Single Logout to configure single logout or session management with OpenID Connect.
See Delegated Access Control for more information on working with OAuth2/OpenIDConnect. See the following topics for samples of configuring delegated access control: