Skip to content

Commit

Permalink
Merge pull request #1 from Biruntha/master
Browse files Browse the repository at this point in the history
Okta keymanager implementation
  • Loading branch information
muthulee authored Jan 11, 2018
2 parents b1a066c + 659f0e1 commit 5803646
Show file tree
Hide file tree
Showing 8 changed files with 2,554 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Compiled class file
*.class
target

# Log file
*.log
Expand All @@ -18,5 +19,14 @@
*.tar.gz
*.rar

# ignore Intellij-IDEA files
*.iml
*.ipr
*.iws
*.settings
*.project
*.idea
.DS_Store

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# apim-keymanager-okta
# Integrate Okta as a third party key manager for APIM

This Okta keymanager implementation allows you to integrate the WSO2 API Store with an external Identity and Access Management (IAM)
by using the Okta OAuth Authorization Server, which is an open source IAM, to manage the OAuth clients and tokens required
by WSO2 API Manager. We have a sample client implementation that consumes APIs exposed by Okta OAuth.

## Build

mvn clean install
106 changes: 106 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.okta.client</groupId>
<artifactId>OKTA-OAuth-Client</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Client implementation to integrate with Okta Authorization Server</name>

<dependencies>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${json.simple.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
<version>${carbon.apimgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.gateway</artifactId>
<version>${carbon.apimgt.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.keymgt</artifactId>
<version>${carbon.apimgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.hostobjects</artifactId>
<version>${carbon.apimgt.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>wso2-nexus</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
org.wso2.okta.client.*;version="1.0.0"
</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<carbon.apimgt.version>6.1.66</carbon.apimgt.version>
<json.simple.version>1.1</json.simple.version>
<gson.version>2.1</gson.version>
</properties>
</project>
81 changes: 81 additions & 0 deletions src/main/java/org/wso2/okta/client/OktaConstants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.okta.client;

/**
* This class will hold constants related to Okta key manager implementation.
*/
public class OktaConstants {
public static final String UTF_8 = "UTF-8";
public static final String HTTP_HEADER_CONTENT_TYPE = "Content-Type";
public static final String APPLICATION_JSON = "application/json";
public static final String AUTHORIZATION = "Authorization";
public static final String AUTHENTICATION_BASIC = "Basic ";
public static final String AUTHENTICATION_SSWS = "SSWS ";
public static final String CLIENT_ENDPOINT = "/oauth2/v1/clients";
public static final String INTROSPECT_ENDPOINT = "/v1/introspect";
public static final String TOKEN_ENDPOINT = "/v1/token";
public static final String REVOKE_ENDPOINT = "/v1/revoke";
public static final String OAUTH2 = "/oauth2/";
public static final String GRANT_TYPE = "grant_type";
public static final String GRANT_TYPE_CLIENT_CREDENTIALS = "client_credentials";
public static final String ACCESS_TOKEN_SCOPE = "scope";
public static final String REGISTRAION_API_KEY = "apiKey";
public static final String CLIENT_REDIRECT_URIS = "redirect_uris";
public static final String CLIENT_GRANT_TYPES = "grant_types";
public static final String CLIENT_NAME = "client_name";
public static final String CLIENT_ID = "client_id";
public static final String CLIENT_SECRET = "client_secret";
public static final String CLIENT_TOKEN_ENDPOINT_AUTH_METHOD = "token_endpoint_auth_method";
public static final String CLIENT_APPLICATION_TYPE = "application_type";
public static final String CLIENT_RESPONSE_TYPES = "response_types";
public static final String CLIENT_LOGO_URI = "logo_uri";
public static final String CLIENT_URI = "client_uri";
public static final String CLIENT_INITIATE_LOGIN_URI = "initiate_login_uri";
public static final String CLIENT_POST_LOGOUT_REDIRECT_URIS = "post_logout_redirect_uris";
public static final String CLIENT_ID_ISSUED_AT = "client_id_issued_at";
public static final String CLIENT_SECRET_EXPIRES_AT = "client_secret_expires_at";
public static final String TOKEN = "token";
public static final String TOKEN_TYPE_HINT = "token_type_hint";
public static final String ACCESS_TOKEN = "access_token";
public static final String ACCESS_TOKEN_ACTIVE = "active";
public static final String ACCESS_TOKEN_EXPIRY = "exp";
public static final String ACCESS_TOKEN_ISSUED = "iat";
public static final String ACCESS_TOKEN_USER_NAME = "username";
public static final String ACCESS_TOKEN_AUDIENCE = "aud";
public static final String ACCESS_TOKEN_ISSUER = "iss";
public static final String ACCESS_TOKEN_TYPE = "token_type";
public static final String ACCESS_TOKEN_SUBJECT = "sub";
public static final String ACCESS_TOKEN_USER_ID = "uid";
public static final String ACCESS_TOKEN_IDENTIFIER = "jti";
public static final String ACCESS_TOKEN_EXPIRES_IN = "expires_in";
public static final String OKTA_INSTANCE_URL = "oktaInstanceUrl";
public static final String OKTA_AUTHORIZATION_SERVER_ID = "authorizationServerId";
public static final String TOKEN_SCOPE = "tokenScope";
public static final String TOKEN_GRANT_TYPE = "tokenGrantType";
public static final String UPDATE_APP_IN_OKTA = "updateAppInOkta";
public static final String ERROR_WHILE_PARSE_RESPONSE = "Error while parsing response json";
public static final String ERROR_ENCODING_METHOD_NOT_SUPPORTED = "Encoding method is not supported";
public static final String ERROR_COULD_NOT_READ_HTTP_ENTITY = "Could not read http entity for response";
public static final String STRING_FORMAT = "%s %s";
public static final String ERROR_OCCURRED_WHILE_READ_OR_CLOSE_BUFFER_READER = "Error has occurred while reading " +
"or closing buffer reader";

OktaConstants() {
}
}
Loading

0 comments on commit 5803646

Please sign in to comment.