This documentation is for WSO2 API Manager 2.1.0. View documentation for the latest release.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In a typical WSO2 API Manager (WSO2 API-M) deployment, different components talk to the KeyManager interface to achieve different tasks. For instance -

...

Therefore, the KeyManager interface acts as the bridge between the OAuth Provider and WSO2 API Manager (WSO2 API-M)

Implement the KeyManager interface, which is a Java extension point in WSO2 API-M, when you are writing your own implementation to plug an external OAuth2 authorization server, which will act as the Key Manager. For this purpose uncomment and update the API Key Manager details under the <APIKeyManager> element and specify the custom class implementation under the <KeyManagerClientImpl> element.

Code Block
<KeyManagerClientImpl>org.wso2.carbon.mit.OpenIDClientImpl</KeyManagerClientImpl>

The following are the methods that the KeyManager interface uses to carry out operations.

  • createApplication - Creates a new OAuth application in the Authorization Server.
  • updateApplication - Updates an OAuth application.
  • retrieveApplication - Retrieves an OAuth application.
  • getNewApplicationAccessToken - The Store calls this method to get a new application Access Token. This method is called when getting the token for the first time and when the Store needs to refresh the existing token.
  • getTokenMetaData - Gets details about an access token.
  • getKeyManagerConfiguration - Gets Key Manager implementation from a JSON file.
  • buildAccessTokenRequestFromJSONThis method will parse the JSON input and add those additional values to the Access Token Request. If it is needed to pass parameters in addition to those specified in the AccessTokenRequest, those parameters can be provided in the JSON input.
  • mapOAuthApplication - You need to use this method when creating an OAuth application in semi-manual mode when you have a consumer key and secret already generated from a Key Manager and you need to map the key and secret with the existing API-M application.
  • buildAccessTokenRequestFromOAuthAppThis method creates an Access Token Request using the OAuth Application information. If the token request is null, this method creates a new object, else it modifies the provided Access Token request.
  • loadConfiguration
  • registerNewResource - This method talks to the APIResource registration endpoint of the authorization server and creates a new resource.
  • getResourceByApiId - This method retrieves the registered resource by the given API ID.
  • updateRegisteredResource - This method contains information about all the API resource by its resourceId.
  •  deleteRegisteredResourceByAPIId - Deletes the registered resource based on the API ID.
  • deleteMappedApplication - 
  • getActiveTokensByConsumerKey
  • getAccessTokenByConsumerKey