Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-08-05 21:29:59 +0000
committerRoberto E. Escobar2014-09-29 22:55:10 +0000
commitc0e8cb4799714839d357772bb1aaa12f8342f2e0 (patch)
tree306f05979828a5ba18cb072a63854cc4aa7dae81
parent8187008050c506fa0b35a884f2760d2bb847c11f (diff)
downloadorg.eclipse.osee-c0e8cb4799714839d357772bb1aaa12f8342f2e0.tar.gz
org.eclipse.osee-c0e8cb4799714839d357772bb1aaa12f8342f2e0.tar.xz
org.eclipse.osee-c0e8cb4799714839d357772bb1aaa12f8342f2e0.zip
feature[ats_ATS64258]: Add OAuth2 JDBC storage
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/JdbcJaxRsOAuthStorageTest.java226
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/jaxrs.jdbc.oauth.schema.resource.xml8
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/jaxrs.jdbc.oauth.storage.xml9
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/AbstractDatabaseStorage.java208
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/AuthCodeGrantStorage.java170
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/JdbcJaxRsOAuthStorage.java92
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/OAuthSchemaResource.java57
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/TokenStorage.java192
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/schema/OAUTH.DS.SCHEMA.xml45
-rw-r--r--plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zipbin58784 -> 58980 bytes
-rw-r--r--plugins/org.eclipse.osee.x.server.p2/demo/hsql.zipbin118430 -> 118612 bytes
13 files changed, 1009 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/JdbcJaxRsOAuthStorageTest.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/JdbcJaxRsOAuthStorageTest.java
new file mode 100644
index 00000000000..f3ce2cd8b62
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/JdbcJaxRsOAuthStorageTest.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.account.admin.integration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.osee.jaxrs.server.security.JaxRsOAuthStorage;
+import org.eclipse.osee.jaxrs.server.security.OAuthCodeGrant;
+import org.eclipse.osee.jaxrs.server.security.OAuthToken;
+import org.eclipse.osee.jaxrs.server.security.OAuthTokenType;
+import org.eclipse.osee.orcs.account.admin.internal.oauth.JdbcJaxRsOAuthStorage;
+import org.eclipse.osee.orcs.db.mock.OsgiService;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TestRule;
+import org.mockito.Mock;
+
+/**
+ * Test Case for {@link JdbcJaxRsOAuthStorage}
+ *
+ * @author Roberto E. Escobar
+ */
+public class JdbcJaxRsOAuthStorageTest {
+
+ private static final String AUTH_CODE_1 = "auth-code-1";
+
+ public static final long CODE_UUID = 5679L;
+ public static final long CLIENT_ID = 912371L;
+ public static final long SUBJECT_ID = 876523L;
+ public static final long ISSUED_AT = 1231L;
+ public static final long EXPIRES_IN = 9876L;
+
+ public static final String REDIRECT_URI = "http://my.redirect.com/callback";
+ public static final String AUDIENCE = "audience-1";
+ public static final List<String> APPROVED_SCOPES = Arrays.asList("a-scope", "b-scope", "c-scope");
+ public static final String CLIENT_CODE_VERIFIER = "client-code-verifier-1";
+
+ public static final long AT_UUID = 612319L;
+ private static final String AT_KEY_1 = "at-key-1";
+ private static final String AT_TOKEN_TYPE_1 = "token-type-1";
+ private static final String AT_GRANT_TYPE_1 = "grant-type-1";
+ private static final OAuthTokenType AT_TYPE_1 = OAuthTokenType.BEARER_TOKEN;
+
+ public static final long RT_UUID = 3219L;
+ private static final String RT_KEY_1 = "rt-key-1";
+ private static final String RT_TOKEN_TYPE_1 = "rt-type-1";
+ private static final String RT_GRANT_TYPE_1 = "rt-grant-type-1";
+ private static final OAuthTokenType RT_TYPE_1 = OAuthTokenType.REFRESH_TOKEN;
+
+ @Rule
+ public TestRule osgi = OrcsIntegrationRule.integrationRule(this, "osee.demo.hsql");
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @OsgiService
+ private JaxRsOAuthStorage storage;
+
+ // @formatter:off
+ @Mock private OAuthCodeGrant authCode;
+ @Mock private OAuthToken accessToken;
+ @Mock private OAuthToken refreshToken;
+ // @formatter:on
+
+ @Before
+ public void testSetup() {
+ initMocks(this);
+
+ when(authCode.getUuid()).thenReturn(CODE_UUID);
+ when(authCode.getClientId()).thenReturn(CLIENT_ID);
+ when(authCode.getSubjectId()).thenReturn(SUBJECT_ID);
+ when(authCode.getIssuedAt()).thenReturn(ISSUED_AT);
+ when(authCode.getExpiresIn()).thenReturn(EXPIRES_IN);
+ when(authCode.getCode()).thenReturn(AUTH_CODE_1);
+ when(authCode.getRedirectUri()).thenReturn(REDIRECT_URI);
+ when(authCode.getAudience()).thenReturn(AUDIENCE);
+ when(authCode.getApprovedScopes()).thenReturn(APPROVED_SCOPES);
+ when(authCode.getClientCodeVerifier()).thenReturn(CLIENT_CODE_VERIFIER);
+
+ when(accessToken.getUuid()).thenReturn(AT_UUID);
+ when(accessToken.getClientId()).thenReturn(CLIENT_ID);
+ when(accessToken.getSubjectId()).thenReturn(SUBJECT_ID);
+ when(accessToken.getIssuedAt()).thenReturn(ISSUED_AT);
+ when(accessToken.getExpiresIn()).thenReturn(EXPIRES_IN);
+ when(accessToken.getTokenKey()).thenReturn(AT_KEY_1);
+ when(accessToken.getTokenType()).thenReturn(AT_TOKEN_TYPE_1);
+ when(accessToken.getType()).thenReturn(AT_TYPE_1);
+ when(accessToken.getGrantType()).thenReturn(AT_GRANT_TYPE_1);
+ when(accessToken.getAudience()).thenReturn(AUDIENCE);
+
+ when(refreshToken.getUuid()).thenReturn(RT_UUID);
+ when(refreshToken.getClientId()).thenReturn(CLIENT_ID);
+ when(refreshToken.getSubjectId()).thenReturn(SUBJECT_ID);
+ when(refreshToken.getIssuedAt()).thenReturn(ISSUED_AT);
+ when(refreshToken.getExpiresIn()).thenReturn(EXPIRES_IN);
+ when(refreshToken.getTokenKey()).thenReturn(RT_KEY_1);
+ when(refreshToken.getTokenType()).thenReturn(RT_TOKEN_TYPE_1);
+ when(refreshToken.getType()).thenReturn(RT_TYPE_1);
+ when(refreshToken.getGrantType()).thenReturn(RT_GRANT_TYPE_1);
+ when(refreshToken.getAudience()).thenReturn(AUDIENCE);
+ }
+
+ @Test
+ public void testAuthCode() {
+ OAuthCodeGrant actual = storage.getCodeGrant(AUTH_CODE_1);
+ assertNull(actual);
+
+ storage.storeCodeGrant(authCode);
+
+ actual = storage.getCodeGrant(AUTH_CODE_1);
+
+ assertEquals(CODE_UUID, actual.getUuid());
+ assertEquals(CLIENT_ID, actual.getClientId());
+ assertEquals(SUBJECT_ID, actual.getSubjectId());
+ assertEquals(ISSUED_AT, actual.getIssuedAt());
+ assertEquals(EXPIRES_IN, actual.getExpiresIn());
+ assertEquals(AUTH_CODE_1, actual.getCode());
+ assertEquals(REDIRECT_URI, actual.getRedirectUri());
+ assertEquals(AUDIENCE, actual.getAudience());
+ assertEquals(APPROVED_SCOPES, actual.getApprovedScopes());
+ assertEquals(CLIENT_CODE_VERIFIER, actual.getClientCodeVerifier());
+
+ storage.removeCodeGrant(authCode);
+
+ actual = storage.getCodeGrant(AUTH_CODE_1);
+ assertNull(actual);
+ }
+
+ @Test
+ public void testAccessToken() {
+ storage.storeToken(accessToken);
+
+ OAuthToken actual = storage.getPreauthorizedToken(CLIENT_ID, SUBJECT_ID, AT_GRANT_TYPE_1);
+
+ assertEquals(AT_UUID, actual.getUuid());
+ assertEquals(CLIENT_ID, actual.getClientId());
+ assertEquals(SUBJECT_ID, actual.getSubjectId());
+ assertEquals(ISSUED_AT, actual.getIssuedAt());
+ assertEquals(EXPIRES_IN, actual.getExpiresIn());
+ assertEquals(AT_KEY_1, actual.getTokenKey());
+ assertEquals(AT_TOKEN_TYPE_1, actual.getTokenType());
+ assertEquals(AT_TYPE_1, actual.getType());
+ assertEquals(AT_GRANT_TYPE_1, actual.getGrantType());
+ assertEquals(AUDIENCE, actual.getAudience());
+ assertNull(actual.getRefreshToken());
+
+ storage.removeTokenByKey(AT_KEY_1);
+
+ actual = storage.getPreauthorizedToken(CLIENT_ID, SUBJECT_ID, AT_GRANT_TYPE_1);
+ assertNull(actual);
+ }
+
+ @Test
+ public void testAccessTokenWithRefreshToken() {
+ storage.storeToken(accessToken, refreshToken);
+ storage.relateTokens(refreshToken, accessToken);
+
+ OAuthToken token1 = storage.getPreauthorizedToken(CLIENT_ID, SUBJECT_ID, AT_GRANT_TYPE_1);
+
+ assertEquals(AT_UUID, token1.getUuid());
+ assertEquals(CLIENT_ID, token1.getClientId());
+ assertEquals(SUBJECT_ID, token1.getSubjectId());
+ assertEquals(ISSUED_AT, token1.getIssuedAt());
+ assertEquals(EXPIRES_IN, token1.getExpiresIn());
+ assertEquals(AT_KEY_1, token1.getTokenKey());
+ assertEquals(AT_TOKEN_TYPE_1, token1.getTokenType());
+ assertEquals(AT_TYPE_1, token1.getType());
+ assertEquals(AT_GRANT_TYPE_1, token1.getGrantType());
+ assertEquals(AUDIENCE, token1.getAudience());
+ assertEquals(RT_KEY_1, token1.getRefreshToken());
+
+ OAuthToken refresh = storage.getPreauthorizedToken(CLIENT_ID, SUBJECT_ID, RT_GRANT_TYPE_1);
+
+ assertEquals(RT_UUID, refresh.getUuid());
+ assertEquals(CLIENT_ID, refresh.getClientId());
+ assertEquals(SUBJECT_ID, refresh.getSubjectId());
+ assertEquals(ISSUED_AT, refresh.getIssuedAt());
+ assertEquals(EXPIRES_IN, refresh.getExpiresIn());
+ assertEquals(RT_KEY_1, refresh.getTokenKey());
+ assertEquals(RT_TOKEN_TYPE_1, refresh.getTokenType());
+ assertEquals(RT_TYPE_1, refresh.getType());
+ assertEquals(RT_GRANT_TYPE_1, refresh.getGrantType());
+ assertEquals(AUDIENCE, refresh.getAudience());
+ assertNull(refresh.getRefreshToken());
+
+ Iterable<OAuthToken> tokens = storage.getAccessTokensByRefreshToken(RT_KEY_1);
+ OAuthToken token2 = tokens.iterator().next();
+
+ assertEquals(AT_UUID, token2.getUuid());
+ assertEquals(CLIENT_ID, token2.getClientId());
+ assertEquals(SUBJECT_ID, token2.getSubjectId());
+ assertEquals(ISSUED_AT, token2.getIssuedAt());
+ assertEquals(EXPIRES_IN, token2.getExpiresIn());
+ assertEquals(AT_KEY_1, token2.getTokenKey());
+ assertEquals(AT_TOKEN_TYPE_1, token2.getTokenType());
+ assertEquals(AT_TYPE_1, token2.getType());
+ assertEquals(AT_GRANT_TYPE_1, token2.getGrantType());
+ assertEquals(AUDIENCE, token2.getAudience());
+ assertEquals(RT_KEY_1, token2.getRefreshToken());
+
+ storage.removeToken(tokens);
+
+ token1 = storage.getPreauthorizedToken(CLIENT_ID, SUBJECT_ID, AT_GRANT_TYPE_1);
+ assertNull(token1);
+
+ storage.removeTokenByKey(RT_KEY_1);
+
+ refresh = storage.getPreauthorizedToken(CLIENT_ID, SUBJECT_ID, RT_GRANT_TYPE_1);
+ assertNull(refresh);
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java
index 2641093105b..a95d625490b 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OsgiIntegrationTestSuite.java
@@ -17,7 +17,7 @@ import org.junit.runners.Suite;
* @author Roberto E. Escobar
*/
@RunWith(Suite.class)
-@Suite.SuiteClasses({OrcsAccountStorageTest.class, OrcsSubscriptionStorageTest.class})
+@Suite.SuiteClasses({JdbcJaxRsOAuthStorageTest.class, OrcsAccountStorageTest.class, OrcsSubscriptionStorageTest.class})
public class OsgiIntegrationTestSuite {
// Test Suite
}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
index 45fd75653b9..ed9006eb53c 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
@@ -18,6 +18,7 @@ Import-Package: org.eclipse.osee.account.admin,
org.eclipse.osee.framework.database.core,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.jaxrs.server.security,
org.eclipse.osee.logger,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/jaxrs.jdbc.oauth.schema.resource.xml b/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/jaxrs.jdbc.oauth.schema.resource.xml
new file mode 100644
index 00000000000..61aa8b703a4
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/jaxrs.jdbc.oauth.schema.resource.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
+ <implementation
+ class="org.eclipse.osee.orcs.account.admin.internal.oauth.OAuthSchemaResource" />
+ <service>
+ <provide interface="org.eclipse.osee.database.schema.SchemaResource"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/jaxrs.jdbc.oauth.storage.xml b/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/jaxrs.jdbc.oauth.storage.xml
new file mode 100644
index 00000000000..d4dfa5faec2
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/jaxrs.jdbc.oauth.storage.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop">
+ <implementation class="org.eclipse.osee.orcs.account.admin.internal.oauth.JdbcJaxRsOAuthStorage" />
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.IOseeDatabaseService" name="IOseeDatabaseService" policy="static"/>
+ <service>
+ <provide interface="org.eclipse.osee.jaxrs.server.security.JaxRsOAuthStorage"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/AbstractDatabaseStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/AbstractDatabaseStorage.java
new file mode 100644
index 00000000000..4dc762aaff2
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/AbstractDatabaseStorage.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.account.admin.internal.oauth;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.Callable;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.database.core.SQL3DataType;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.ResultSet;
+import org.eclipse.osee.framework.jdk.core.type.ResultSets;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractDatabaseStorage<T> {
+
+ private final Log logger;
+ private final IOseeDatabaseService dbService;
+
+ public AbstractDatabaseStorage(Log logger, IOseeDatabaseService dbService) {
+ super();
+ this.logger = logger;
+ this.dbService = dbService;
+ }
+
+ protected Object asVarcharOrNull(String value) {
+ return value != null ? value : SQL3DataType.VARCHAR;
+ }
+
+ protected abstract Object[] asInsert(T item);
+
+ protected abstract Object[] asUpdate(T item);
+
+ protected abstract Object[] asDelete(T item);
+
+ protected abstract T readData(IOseeStatement chStmt);
+
+ protected <R> R execute(Callable<R> callable) {
+ try {
+ return callable.call();
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ protected T selectOneOrNull(final String query, final Object... data) {
+ return execute(select(query, data)).getOneOrNull();
+ }
+
+ protected ResultSet<T> selectItems(final String query, final Object... data) {
+ return execute(select(query, data));
+ }
+
+ protected void insertItems(final String insertSql, final T... items) {
+ insertItems(insertSql, Arrays.asList(items));
+ }
+
+ protected void insertItems(final String insertSql, final Iterable<T> items) {
+ execute(insert(insertSql, items));
+ }
+
+ protected void deleteItems(final String deleteSql, final T... items) {
+ deleteItems(deleteSql, Arrays.asList(items));
+ }
+
+ protected void deleteItems(final String deleteSql, final Iterable<T> items) {
+ execute(delete(deleteSql, items));
+ }
+
+ protected void updateItems(final String insertSql, final T... items) {
+ updateItems(insertSql, Arrays.asList(items));
+ }
+
+ protected void updateItems(final String updateSql, final Iterable<T> items) {
+ execute(update(updateSql, items));
+ }
+
+ protected long countItems(final String countSql, final Object... data) {
+ return execute(count(countSql, data));
+ }
+
+ private Callable<ResultSet<T>> select(final String query, final Object... data) {
+ return new AbstractCallable<Object[], ResultSet<T>>(query, data) {
+
+ @Override
+ protected ResultSet<T> innerCall() throws Exception {
+ List<T> list = new LinkedList<T>();
+ IOseeStatement chStmt = dbService.getStatement();
+ try {
+ chStmt.runPreparedQuery(query, data);
+ while (chStmt.next()) {
+ T data = readData(chStmt);
+ list.add(data);
+ }
+ } finally {
+ chStmt.close();
+ }
+ return ResultSets.newResultSet(list);
+ }
+ };
+ }
+
+ private Callable<Long> count(final String query, final Object... data) {
+ return new AbstractCallable<Object[], Long>(query, data) {
+
+ @Override
+ protected Long innerCall() throws Exception {
+ return dbService.runPreparedQueryFetchObject(-1L, query, data);
+ }
+ };
+ }
+
+ private Callable<Integer> insert(final String insertSql, final Iterable<T> items) {
+ return new AbstractCallable<Iterable<T>, Integer>(insertSql, items) {
+
+ @Override
+ protected Integer innerCall() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+ for (T item : items) {
+ data.add(asInsert(item));
+ }
+ return dbService.runBatchUpdate(insertSql, data);
+ }
+ };
+ }
+
+ private Callable<Integer> delete(final String deleteSql, final Iterable<T> items) {
+ return new AbstractCallable<Iterable<T>, Integer>(deleteSql, items) {
+
+ @Override
+ protected Integer innerCall() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+ for (T item : items) {
+ data.add(asDelete(item));
+ }
+ return dbService.runBatchUpdate(deleteSql, data);
+ }
+ };
+ }
+
+ private Callable<Integer> update(final String updateSql, final Iterable<T> items) {
+ return new AbstractCallable<Iterable<T>, Integer>(updateSql, items) {
+
+ @Override
+ protected Integer innerCall() throws Exception {
+ List<Object[]> data = new ArrayList<Object[]>();
+ for (T item : items) {
+ data.add(asUpdate(item));
+ }
+ return dbService.runBatchUpdate(updateSql, data);
+ }
+ };
+ }
+
+ protected abstract class AbstractCallable<I, O> implements Callable<O> {
+
+ protected final String query;
+ protected final I data;
+
+ public AbstractCallable(String query, I data) {
+ super();
+ this.query = query;
+ this.data = data;
+ }
+
+ protected IOseeDatabaseService getDbService() {
+ return dbService;
+ }
+
+ @Override
+ public final O call() throws Exception {
+ long startTime = System.currentTimeMillis();
+ long endTime = startTime;
+ O result = null;
+ try {
+ if (logger.isTraceEnabled()) {
+ logger.trace("%s [start] - [%s] [%s]", getClass().getSimpleName(), query, data);
+ }
+ result = innerCall();
+ } finally {
+ endTime = System.currentTimeMillis() - startTime;
+ }
+ if (logger.isTraceEnabled()) {
+ logger.trace("%s [finished] - [%s] [%s] [%s]", getClass().getSimpleName(), Lib.asTimeString(endTime),
+ query, data);
+ }
+ return result;
+ }
+
+ protected abstract O innerCall() throws Exception;
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/AuthCodeGrantStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/AuthCodeGrantStorage.java
new file mode 100644
index 00000000000..33ae320862e
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/AuthCodeGrantStorage.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.account.admin.internal.oauth;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.jaxrs.server.security.OAuthCodeGrant;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AuthCodeGrantStorage extends AbstractDatabaseStorage<OAuthCodeGrant> {
+
+ private static final String SCOPES_SEPARATOR = ";";
+
+ private static final String SELECT_AUTH_CODE_BY_CODE = "SELECT * FROM osee_oauth_authorization WHERE code = ?";
+
+ private static final String INSERT_AUTH_CODE =
+ "INSERT INTO osee_oauth_authorization (id, client_id, subject_id, issued_at, expires_in, code, redirect_uri, verifier, audience, approved_scopes) VALUES (?,?,?,?,?,?,?,?,?,?)";
+
+ private static final String DELETE_AUTH_CODE_BY_ID = "DELETE FROM osee_oauth_authorization WHERE id = ?";
+
+ public AuthCodeGrantStorage(Log logger, IOseeDatabaseService dbService) {
+ super(logger, dbService);
+ }
+
+ @Override
+ protected Object[] asInsert(OAuthCodeGrant data) {
+ return new Object[] {
+ data.getUuid(),
+ data.getClientId(),
+ data.getSubjectId(),
+ data.getIssuedAt(),
+ data.getExpiresIn(),
+ data.getCode(),
+ asVarcharOrNull(data.getRedirectUri()),
+ asVarcharOrNull(data.getClientCodeVerifier()),
+ asVarcharOrNull(data.getAudience()),
+ asScopesStore(data.getApprovedScopes())};
+ }
+
+ @Override
+ protected Object[] asUpdate(OAuthCodeGrant data) {
+ return new Object[] {data.getUuid()};
+ }
+
+ @Override
+ protected Object[] asDelete(OAuthCodeGrant data) {
+ return new Object[] {data.getUuid()};
+ }
+
+ public OAuthCodeGrant getByCode(String code) {
+ return selectOneOrNull(SELECT_AUTH_CODE_BY_CODE, code);
+ }
+
+ public void insert(OAuthCodeGrant data) {
+ insertItems(INSERT_AUTH_CODE, data);
+ }
+
+ public void delete(OAuthCodeGrant data) {
+ deleteItems(DELETE_AUTH_CODE_BY_ID, data);
+ }
+
+ public void delete(Iterable<OAuthCodeGrant> datas) {
+ deleteItems(DELETE_AUTH_CODE_BY_ID, datas);
+ }
+
+ private List<String> parseScopes(String scopes) {
+ List<String> toReturn = Collections.emptyList();
+ if (scopes != null) {
+ toReturn = new ArrayList<String>();
+ String[] scopeValues = scopes.split(SCOPES_SEPARATOR);
+ for (String scope : scopeValues) {
+ if (Strings.isValid(scope)) {
+ toReturn.add(scope);
+ }
+ }
+ }
+ return toReturn;
+ }
+
+ private Object asScopesStore(List<String> scopes) {
+ String scopeData = null;
+ if (scopes != null && !scopes.isEmpty()) {
+ scopeData = org.eclipse.osee.framework.jdk.core.util.Collections.toString(SCOPES_SEPARATOR, scopes);
+ }
+ return asVarcharOrNull(scopeData);
+ }
+
+ @Override
+ protected OAuthCodeGrant readData(IOseeStatement chStmt) {
+ final long uuid = chStmt.getLong("id");
+ final long clientId = chStmt.getLong("client_id");
+ final long subjectId = chStmt.getLong("subject_id");
+ final long issuedAt = chStmt.getLong("issued_at");
+ final long expiresIn = chStmt.getLong("expires_in");
+ final String code = chStmt.getString("code");
+ final String redirect_uri = chStmt.getString("redirect_uri");
+ final String verifier = chStmt.getString("verifier");
+ final String audience = chStmt.getString("audience");
+ final List<String> approvedScopes = parseScopes(chStmt.getString("approved_scopes"));
+ return new OAuthCodeGrant() {
+
+ @Override
+ public long getUuid() {
+ return uuid;
+ }
+
+ @Override
+ public long getSubjectId() {
+ return subjectId;
+ }
+
+ @Override
+ public long getClientId() {
+ return clientId;
+ }
+
+ @Override
+ public long getIssuedAt() {
+ return issuedAt;
+ }
+
+ @Override
+ public long getExpiresIn() {
+ return expiresIn;
+ }
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+
+ @Override
+ public String getRedirectUri() {
+ return redirect_uri;
+ }
+
+ @Override
+ public String getClientCodeVerifier() {
+ return verifier;
+ }
+
+ @Override
+ public String getAudience() {
+ return audience;
+ }
+
+ @Override
+ public List<String> getApprovedScopes() {
+ return approvedScopes;
+ }
+
+ };
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/JdbcJaxRsOAuthStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/JdbcJaxRsOAuthStorage.java
new file mode 100644
index 00000000000..bc1739b31f4
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/JdbcJaxRsOAuthStorage.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.account.admin.internal.oauth;
+
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.jaxrs.server.security.JaxRsOAuthStorage;
+import org.eclipse.osee.jaxrs.server.security.OAuthCodeGrant;
+import org.eclipse.osee.jaxrs.server.security.OAuthToken;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class JdbcJaxRsOAuthStorage implements JaxRsOAuthStorage {
+
+ private Log logger;
+ private IOseeDatabaseService dbService;
+
+ private AuthCodeGrantStorage authCodeGrantStorage;
+ private TokenStorage tokenStorage;
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void setDatabaseService(IOseeDatabaseService dbService) {
+ this.dbService = dbService;
+ }
+
+ public void start() {
+ authCodeGrantStorage = new AuthCodeGrantStorage(logger, dbService);
+ tokenStorage = new TokenStorage(logger, dbService);
+ }
+
+ public void stop() {
+ //
+ }
+
+ @Override
+ public OAuthCodeGrant getCodeGrant(String code) {
+ return authCodeGrantStorage.getByCode(code);
+ }
+
+ @Override
+ public void storeCodeGrant(OAuthCodeGrant code) {
+ authCodeGrantStorage.insert(code);
+ }
+
+ @Override
+ public void removeCodeGrant(OAuthCodeGrant code) {
+ authCodeGrantStorage.delete(code);
+ }
+
+ @Override
+ public Iterable<OAuthToken> getAccessTokensByRefreshToken(String refreshToken) {
+ return tokenStorage.getAccessTokenByRefreshToken(refreshToken);
+ }
+
+ @Override
+ public OAuthToken getPreauthorizedToken(long clientUuid, long subjectUuid, String grantType) {
+ return tokenStorage.getPreauthorizedToken(clientUuid, subjectUuid, grantType);
+ }
+
+ @Override
+ public void storeToken(OAuthToken... tokens) {
+ tokenStorage.insertTokens(tokens);
+ }
+
+ @Override
+ public void relateTokens(OAuthToken parentToken, OAuthToken childToken) {
+ tokenStorage.relateTokens(parentToken, childToken);
+ }
+
+ @Override
+ public void removeToken(Iterable<OAuthToken> tokens) {
+ tokenStorage.deleteToken(tokens);
+ }
+
+ @Override
+ public void removeTokenByKey(String tokenKey) {
+ tokenStorage.deleteTokenByKey(tokenKey);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/OAuthSchemaResource.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/OAuthSchemaResource.java
new file mode 100644
index 00000000000..d78ec5d7da3
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/OAuthSchemaResource.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.account.admin.internal.oauth;
+
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import org.eclipse.osee.database.schema.SchemaResource;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OAuthSchemaResource implements SchemaResource {
+
+ private static final String SCHEMA_PATH = "schema/OAUTH.DS.SCHEMA.xml";
+
+ @Override
+ public InputStream getContent() throws OseeCoreException {
+ InputStream inputStream = null;
+ try {
+ URL url = getResourceURL();
+ inputStream = new BufferedInputStream(url.openStream());
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
+ return inputStream;
+ }
+
+ @Override
+ public boolean isApplicable() {
+ return true;
+ }
+
+ @Override
+ public URI getLocation() throws OseeCoreException {
+ try {
+ return getResourceURL().toURI();
+ } catch (URISyntaxException ex) {
+ throw new OseeCoreException(ex, "Error finding [%s] schema resource", SCHEMA_PATH);
+ }
+ }
+
+ private URL getResourceURL() {
+ return getClass().getResource(SCHEMA_PATH);
+ }
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/TokenStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/TokenStorage.java
new file mode 100644
index 00000000000..475db607542
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/TokenStorage.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.orcs.account.admin.internal.oauth;
+
+import org.eclipse.osee.framework.database.IOseeDatabaseService;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.type.ResultSet;
+import org.eclipse.osee.jaxrs.server.security.OAuthToken;
+import org.eclipse.osee.jaxrs.server.security.OAuthTokenType;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TokenStorage extends AbstractDatabaseStorage<OAuthToken> {
+
+ private static final long NULL_PARENT_ID = -1L;
+
+ private static final String SELECT_TOKEN_BY_PARENT_TOKEN = //
+ "WITH parent_token (id, refresh_key) AS (SELECT id, token_key FROM osee_oauth_token WHERE token_key = ? AND type_id = ?)" //
+ + "SELECT tk1.*, parent_token.refresh_key FROM osee_oauth_token tk1, parent_token WHERE tk1.parent_token_id = parent_token.id AND tk1.type_id = ?";
+
+ private static final String SELECT_TOKEN_BY_CLIENT_ID_SUBJECT_ID_AND_GRANT_TYPE =
+ "SELECT t1.*, t2.token_key AS refresh_key FROM osee_oauth_token t1 " //
+ + "LEFT OUTER JOIN osee_oauth_token t2 ON t2.id = t1.parent_token_id WHERE t1.client_id = ? AND t1.subject_id = ? AND t1.grant_type = ?";
+
+ private static final String INSERT_TOKEN =
+ "INSERT INTO osee_oauth_token (id, client_id, subject_id, issued_at, expires_in, token_key, token_type, grant_type, audience, parent_token_id, type_id) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
+
+ private static final String DELETE_TOKEN_BY_ID = "DELETE FROM osee_oauth_token WHERE id = ?";
+
+ private static final String DELETE_TOKEN_BY_TOKEN_KEY = "DELETE FROM osee_oauth_token WHERE token_key = ?";
+
+ private static final String UPDATE_TOKEN_PARENT_BY_ID =
+ "UPDATE osee_oauth_token SET parent_token_id = ? WHERE id = ?";
+
+ public TokenStorage(Log logger, IOseeDatabaseService dbService) {
+ super(logger, dbService);
+ }
+
+ @Override
+ protected Object[] asInsert(OAuthToken data) {
+ OAuthTokenType type = data.getType();
+ return new Object[] {
+ data.getUuid(),
+ data.getClientId(),
+ data.getSubjectId(),
+ data.getIssuedAt(),
+ data.getExpiresIn(),
+ data.getTokenKey(),
+ data.getTokenType(),
+ data.getGrantType(),
+ asVarcharOrNull(data.getAudience()),
+ NULL_PARENT_ID,
+ type.getValue()};
+ }
+
+ @Override
+ protected Object[] asUpdate(OAuthToken data) {
+ return new Object[] {data.getUuid()};
+ }
+
+ @Override
+ protected Object[] asDelete(OAuthToken data) {
+ return new Object[] {data.getUuid()};
+ }
+
+ public OAuthToken getPreauthorizedToken(long clientUuid, long subjectUuid, String grantType) {
+ return selectOneOrNull(SELECT_TOKEN_BY_CLIENT_ID_SUBJECT_ID_AND_GRANT_TYPE, clientUuid, subjectUuid, grantType);
+ }
+
+ public ResultSet<OAuthToken> getAccessTokenByRefreshToken(String tokenKey) {
+ return selectItems(SELECT_TOKEN_BY_PARENT_TOKEN, tokenKey, OAuthTokenType.REFRESH_TOKEN.getValue(),
+ OAuthTokenType.BEARER_TOKEN.getValue());
+ }
+
+ public void insertTokens(OAuthToken... tokens) {
+ insertItems(INSERT_TOKEN, tokens);
+ }
+
+ public void relateTokens(final OAuthToken parentToken, final OAuthToken childToken) {
+ Object[] data = new Object[] {parentToken.getUuid(), childToken.getUuid()};
+ execute(new AbstractCallable<Object[], Void>(UPDATE_TOKEN_PARENT_BY_ID, data) {
+
+ @Override
+ protected Void innerCall() throws Exception {
+ getDbService().runPreparedUpdate(query, data);
+ return null;
+ }
+
+ });
+ }
+
+ public void deleteToken(Iterable<OAuthToken> datas) {
+ deleteItems(DELETE_TOKEN_BY_ID, datas);
+ }
+
+ public void deleteTokenByKey(final String tokenKey) {
+ execute(new AbstractCallable<String, Void>(DELETE_TOKEN_BY_TOKEN_KEY, tokenKey) {
+
+ @Override
+ protected Void innerCall() throws Exception {
+ getDbService().runPreparedUpdate(DELETE_TOKEN_BY_TOKEN_KEY, tokenKey);
+ return null;
+ }
+
+ });
+ }
+
+ @Override
+ protected OAuthToken readData(IOseeStatement chStmt) {
+ final long uuid = chStmt.getLong("id");
+ final long clientId = chStmt.getLong("client_id");
+ final long subjectId = chStmt.getLong("subject_id");
+ final long issuedAt = chStmt.getLong("issued_at");
+ final long expiresIn = chStmt.getLong("expires_in");
+ final String tokenKey = chStmt.getString("token_key");
+ final String tokenType = chStmt.getString("token_type");
+ final String grantType = chStmt.getString("grant_type");
+ final String audience = chStmt.getString("audience");
+ final OAuthTokenType type = OAuthTokenType.fromValue(chStmt.getInt("type_id"));
+
+ final String refreshToken = chStmt.getString("refresh_key");
+ return new OAuthToken() {
+
+ @Override
+ public long getUuid() {
+ return uuid;
+ }
+
+ @Override
+ public long getSubjectId() {
+ return subjectId;
+ }
+
+ @Override
+ public long getClientId() {
+ return clientId;
+ }
+
+ @Override
+ public long getIssuedAt() {
+ return issuedAt;
+ }
+
+ @Override
+ public long getExpiresIn() {
+ return expiresIn;
+ }
+
+ @Override
+ public String getTokenKey() {
+ return tokenKey;
+ }
+
+ @Override
+ public String getTokenType() {
+ return tokenType;
+ }
+
+ @Override
+ public String getGrantType() {
+ return grantType;
+ }
+
+ @Override
+ public String getAudience() {
+ return audience;
+ }
+
+ @Override
+ public OAuthTokenType getType() {
+ return type;
+ }
+
+ @Override
+ public String getRefreshToken() {
+ return refreshToken;
+ }
+
+ };
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/schema/OAUTH.DS.SCHEMA.xml b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/schema/OAUTH.DS.SCHEMA.xml
new file mode 100644
index 00000000000..421f4447bb6
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/schema/OAUTH.DS.SCHEMA.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TableConfig>
+
+ <Table name="OSEE_OAUTH_AUTHORIZATION" schema="OSEE" tablespace="osee_data">
+ <Column id="ID" defaultValue="not null" type="BIGINT" />
+ <Column id="CLIENT_ID" defaultValue="not null" type="BIGINT" />
+ <Column id="SUBJECT_ID" defaultValue="not null" type="BIGINT" />
+ <Column id="ISSUED_AT" defaultValue="not null" type="BIGINT" />
+ <Column id="EXPIRES_IN" defaultValue="not null" type="BIGINT" />
+
+ <Column id="CODE" defaultValue="not null" limits="512" type="VARCHAR" />
+
+ <Column id="REDIRECT_URI" limits="512" type="VARCHAR" />
+ <Column id="VERIFIER" limits="512" type="VARCHAR" />
+ <Column id="AUDIENCE" limits="512" type="VARCHAR" />
+ <Column id="APPROVED_SCOPES" limits="2000" type="VARCHAR" />
+
+ <Constraint schema="OSEE" id="OSEE_OAUTH_AUTHORIZATION__ID_PK" type="PRIMARY KEY" appliesTo="ID" />
+ <Index id="OSEE_OAUTH_AUTHORIZATION__C_IDX" type="UNIQUE" tablespace="osee_index">
+ <AppliesTo id="CODE" />
+ </Index>
+ </Table>
+
+ <Table name="OSEE_OAUTH_TOKEN" schema="OSEE" tablespace="osee_data">
+ <Column id="ID" defaultValue="not null" type="BIGINT" />
+ <Column id="CLIENT_ID" defaultValue="not null" type="BIGINT" />
+ <Column id="SUBJECT_ID" defaultValue="not null" type="BIGINT" />
+ <Column id="ISSUED_AT" defaultValue="not null" type="BIGINT" />
+ <Column id="EXPIRES_IN" defaultValue="not null" type="BIGINT" />
+
+ <Column id="TOKEN_KEY" defaultValue="not null" limits="512" type="VARCHAR" />
+ <Column id="GRANT_TYPE" defaultValue="not null" limits="255" type="VARCHAR" />
+
+ <Column id="TYPE_ID" defaultValue="not null" type="SMALLINT" />
+ <Column id="TOKEN_TYPE" defaultValue="not null" limits="255" type="VARCHAR" />
+ <Column id="AUDIENCE" limits="512" type="VARCHAR" />
+ <Column id="PARENT_TOKEN_ID" defaultValue="not null" type="BIGINT" />
+
+ <Constraint schema="OSEE" id="OSEE_OAUTH_TOKEN__ID_PK" type="PRIMARY KEY" appliesTo="ID" />
+ <Index id="OSEE_OAUTH_TOKEN__TK_IDX" type="UNIQUE" tablespace="osee_index">
+ <AppliesTo id="TOKEN_KEY" />
+ </Index>
+ </Table>
+
+</TableConfig>
diff --git a/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip b/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
index 26c6b3055e8..9fba55294b5 100644
--- a/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
+++ b/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
Binary files differ
diff --git a/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip b/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
index cdad955dbc9..9943676e6a5 100644
--- a/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
+++ b/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
Binary files differ

Back to the top