Top Banner
Last Updated: Jan. 2014
28

Using a Third Party Key Management System with WSO2 API Manager

Aug 21, 2015

Download

Technology

WSO2
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Using a Third Party Key Management System with WSO2 API Manager

Last Updated: Jan. 2014

Page 2: Using a Third Party Key Management System with WSO2 API Manager

Page 3: Using a Third Party Key Management System with WSO2 API Manager

● WSO2 API Manager is a complete open-source solution for creating and publishing APIs and managing all aspects of their lifecycle.

● Using WSO2 APIM, you can -- Create and publish APIs -- Advertise APIs in the storefront -- Version APIs -- Manage the lifecycle -- Monitor and Analyze API Usage -- Implement governance and security -- Facilitate community engagement -- Provide extension points

https://docs.wso2.com/display/AM190/Introducing+the+API+Manager

Page 4: Using a Third Party Key Management System with WSO2 API Manager
Page 5: Using a Third Party Key Management System with WSO2 API Manager

Page 6: Using a Third Party Key Management System with WSO2 API Manager

Page 7: Using a Third Party Key Management System with WSO2 API Manager

Page 9: Using a Third Party Key Management System with WSO2 API Manager

Connect the web app to protected resource / API

Simple web app Protected resource / API.

Page 10: Using a Third Party Key Management System with WSO2 API Manager

End user

Web app

Initial request

authenticate / authorize

Redirect

Authorization code.

Token

Protected resource.

OAuth2 Authorization manager

12

3

4

56

7

Page 14: Using a Third Party Key Management System with WSO2 API Manager

● WSO2 identity server. https://wso2.com/products/identity-server/

● Open AM https://www.forgerock.com/products/access-management/

● mitreid-connect https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server

● Surf oAuth https://github.com/OAuth-Apis/apis

Page 15: Using a Third Party Key Management System with WSO2 API Manager

OpenID Connect reference implementation in Java on the Spring platform.

https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/

Page 16: Using a Third Party Key Management System with WSO2 API Manager
Page 17: Using a Third Party Key Management System with WSO2 API Manager

<APIKeyManager><KeyManagerClientImpl>org.wso2.carbon.mit.

OpenIDClientImpl</KeyManagerClientImpl> <Configuration>

…………………………………………………………..<ResourceRegistrationEndpoint>

http://localhost:8080/openid-connect-server-webapp/resource</ResourceRegistrationEndpoint><OIDCDcrEndpoint>

http://localhost:8080/openid-connect-server-webapp/register</OIDCDcrEndpoint>

…………………………………………………………….. </Configuration>

</APIKeyManager>

Page 18: Using a Third Party Key Management System with WSO2 API Manager

<APIKeyValidator> <!--

Specifies the implementation to be used for KeyValidationHandler. Steps for validating a token can be controlled by plugging in a custom KeyValidation Handler

--> <KeyValidationHandlerClassName>org.wso2.carbon.apimgt.keymgt.handlers.DefaultKeyValidationHandler</KeyValidationHandlerClassName>

</APIKeyValidator>

Page 19: Using a Third Party Key Management System with WSO2 API Manager

● Implement KeyManager interface when you are writing your own implementation.<KeyManagerClientImpl>org.wso2.carbon.mit.OpenIDClientImpl</KeyManagerClientImpl>

-- createApplication() -Create a new OAuth application in the Authorization Server-- updateApplication()-Update an OAuth application-- retrieveApplication()- Retrieve an Oauth application-- getNewApplicationAccessToken()-Store calls this method to get a new Application Access Token.-- getTokenMetaData()-Get details about an access token-- getKeyManagerConfiguration()- Get Key manager implementation from a json file-- buildAccessTokenRequestFromJSON()-- mapOAuthApplication()-Use when to create a OAuth application in semi-manual mode-- buildAccessTokenRequestFromOAuthApp()

https://github.com/wso2/carbon-apimgt/blob/release-1.9.1/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/KeyManager.java

Page 20: Using a Third Party Key Management System with WSO2 API Manager

-- loadConfiguration()

-- registerNewResource()-- getResourceByApiId()-- updateRegisteredResource()-- deleteRegisteredResourceByAPIId()-- deleteMappedApplication()-- getActiveTokensByConsumerKey()-- getAccessTokenByConsumerKey()

https://github.com/wso2/carbon-apimgt/blob/release-1.9.1/components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/KeyManager.java

Page 21: Using a Third Party Key Management System with WSO2 API Manager

● Implement KeyValidationHandler interface when you are writing your own implementation.<KeyValidationHandlerClassName>org.wso2.carbon.apimgt.keymgt.handlers.

DefaultKeyValidationHandler</KeyValidationHandlerClassName>

-- validateToken()-- validateSubscription()-- validateScopes()-- generateConsumeToken()- JWT token this will use to default implementationhttps://github.com/wso2/carbon-apimgt/blob/release-1.9.1/components/apimgt/org.wso2.carbon.

apimgt.keymgt/src/main/java/org/wso2/carbon/apimgt/keymgt/handlers/KeyValidationHandler.java

Page 22: Using a Third Party Key Management System with WSO2 API Manager

Create OAuth client at key manager

curl -k -X POST -b cookies https://localhost:9443/store/site/blocks/subscription/subscription-add/ajax/subscription-add.jag -d 'action=generateApplicationKey&application=NewApp1&keytype=PRODUCTION&authorizedDomains=ALL&callbackUrl=&validityTime=3600&tokenScope=&jsonParams={"paramname":"paramvalue"}'

Sample jsonParams for MITred-Connect implementation {"allowDomains":"ALL","callback_url":["dfsds"],"client_name":"jh_sandbox","contact":[],"

grant_types":[],"response_types":[],"scope":["phone","openid","offline_access","address","email","profile"],"token_endpoint_auth_method":null}

https://docs.wso2.com/display/AM190/Store+APIs

Page 23: Using a Third Party Key Management System with WSO2 API Manager

Update OAuth client

curl -k -X POST -b cookies https://localhost:9443/store/site/blocks/subscription/subscription-add/ajax/subscription-add.jag -d 'action=updateClientApplication&application=NewApp1&keytype=PRODUCTION&authorizedDomains=ALL&callbackUrl=&validityTime=3600&tokenScope=&jsonParams={"paramname":"paramvalue"}'

Sample jsonParams for MITred-Connect implementation {"allowDomains":"ALL","callback_url":["dfsds"],"client_name":"jh_sandbox","contact":[],"

grant_types":[],"response_types":[],"scope":["phone","openid","offline_access","address","email","profile"],"token_endpoint_auth_method":null}

Page 26: Using a Third Party Key Management System with WSO2 API Manager
Page 27: Using a Third Party Key Management System with WSO2 API Manager
Page 28: Using a Third Party Key Management System with WSO2 API Manager