Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-01-07 02:55:56 +0000
committerRyan D. Brooks2014-01-07 02:55:56 +0000
commit3c058b92a0d3a0bb8447bca4f6698c75707c43cd (patch)
tree3ec397946282f05290017da2425597a61bcb7366
parentdc5210396de33e83b7488fdad2b675c074416389 (diff)
downloadorg.eclipse.osee-3c058b92a0d3a0bb8447bca4f6698c75707c43cd.tar.gz
org.eclipse.osee-3c058b92a0d3a0bb8447bca4f6698c75707c43cd.tar.xz
org.eclipse.osee-3c058b92a0d3a0bb8447bca4f6698c75707c43cd.zip
feature[ats_ATS8935]: Create Authorization Admin
-rw-r--r--features/org.eclipse.osee.x.core.feature/feature.xml7
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/.classpath (renamed from plugins/org.eclipse.osee.authorization/.classpath)0
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/.project (renamed from plugins/org.eclipse.osee.authorization/.project)2
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/META-INF/MANIFEST.MF15
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/build.properties (renamed from plugins/org.eclipse.osee.authorization/build.properties)0
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/pom.xml30
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/AuthAdminTestSuite.java24
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/AuthorizationAdminImplTest.java379
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/AuthorizationConfigurationBuilderTest.java108
-rw-r--r--plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/InternalTestSuite.java23
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/.classpath7
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/.project33
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/META-INF/MANIFEST.MF13
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/OSGI-INF/authorization.admin.xml11
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/OSGI-INF/none.authorization.provider.xml7
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/build.properties5
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/pom.xml34
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/Authority.java22
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/Authorization.java27
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationAdmin.java26
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConfiguration.java24
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConfigurationBuilder.java149
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConstants.java40
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationData.java26
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationOverride.java36
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationProvider.java22
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationRequest.java30
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationRequestBuilder.java111
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationAdminImpl.java187
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationImpl.java68
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationUtil.java39
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/DenyAllAuthority.java31
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/NoneAuthorizationProvider.java50
-rw-r--r--plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/PermitAllAuthority.java31
-rw-r--r--plugins/org.eclipse.osee.authorization/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.osee.authorization/src/org/eclipse/osee/authorization/placeholder.txt0
-rw-r--r--plugins/org.eclipse.osee.x.core.parent/pom.xml5
37 files changed, 1620 insertions, 10 deletions
diff --git a/features/org.eclipse.osee.x.core.feature/feature.xml b/features/org.eclipse.osee.x.core.feature/feature.xml
index fc03616c0e..0bb8e79522 100644
--- a/features/org.eclipse.osee.x.core.feature/feature.xml
+++ b/features/org.eclipse.osee.x.core.feature/feature.xml
@@ -214,4 +214,11 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.eclipse.osee.authorization.admin"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
diff --git a/plugins/org.eclipse.osee.authorization/.classpath b/plugins/org.eclipse.osee.authorization.admin.test/.classpath
index ad32c83a78..ad32c83a78 100644
--- a/plugins/org.eclipse.osee.authorization/.classpath
+++ b/plugins/org.eclipse.osee.authorization.admin.test/.classpath
diff --git a/plugins/org.eclipse.osee.authorization/.project b/plugins/org.eclipse.osee.authorization.admin.test/.project
index c81f64e5c0..11933ae552 100644
--- a/plugins/org.eclipse.osee.authorization/.project
+++ b/plugins/org.eclipse.osee.authorization.admin.test/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.osee.authorization</name>
+ <name>org.eclipse.osee.authorization.admin.test</name>
<comment></comment>
<projects>
</projects>
diff --git a/plugins/org.eclipse.osee.authorization.admin.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.authorization.admin.test/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..0e436c5a0b
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin.test/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Authorization Admin Test (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.authorization.admin.test
+Bundle-Version: 0.17.0.qualifier
+Fragment-Host: org.eclipse.osee.authorization.admin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Import-Package: org.hamcrest.core,
+ org.junit,
+ org.junit.rules,
+ org.junit.runner,
+ org.junit.runners,
+ org.mockito,
+ org.mockito.stubbing
diff --git a/plugins/org.eclipse.osee.authorization/build.properties b/plugins/org.eclipse.osee.authorization.admin.test/build.properties
index 34d2e4d2da..34d2e4d2da 100644
--- a/plugins/org.eclipse.osee.authorization/build.properties
+++ b/plugins/org.eclipse.osee.authorization.admin.test/build.properties
diff --git a/plugins/org.eclipse.osee.authorization.admin.test/pom.xml b/plugins/org.eclipse.osee.authorization.admin.test/pom.xml
new file mode 100644
index 0000000000..8e4b6200db
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin.test/pom.xml
@@ -0,0 +1,30 @@
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.orcs.parent</artifactId>
+ <version>0.17.0-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.orcs.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.authorization.admin.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+ <name>OSEE Authorization Admin Test - (Incubation)</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <testSuite>org.eclipse.osee.authorization.admin.test</testSuite>
+ <testClass>org.eclipse.osee.authorization.admin.AuthAdminTestSuite</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/AuthAdminTestSuite.java b/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/AuthAdminTestSuite.java
new file mode 100644
index 0000000000..c22708d9d8
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/AuthAdminTestSuite.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+import org.eclipse.osee.authorization.admin.internal.InternalTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({InternalTestSuite.class})
+public class AuthAdminTestSuite {
+ // Test Suite
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/AuthorizationAdminImplTest.java b/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/AuthorizationAdminImplTest.java
new file mode 100644
index 0000000000..a6e40db6f5
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/AuthorizationAdminImplTest.java
@@ -0,0 +1,379 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+import java.security.Principal;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.osee.authorization.admin.Authority;
+import org.eclipse.osee.authorization.admin.Authorization;
+import org.eclipse.osee.authorization.admin.AuthorizationConstants;
+import org.eclipse.osee.authorization.admin.AuthorizationData;
+import org.eclipse.osee.authorization.admin.AuthorizationOverride;
+import org.eclipse.osee.authorization.admin.AuthorizationProvider;
+import org.eclipse.osee.authorization.admin.AuthorizationRequest;
+import org.eclipse.osee.authorization.admin.AuthorizationRequestBuilder;
+import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
+import org.eclipse.osee.logger.Log;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+
+/**
+ * Test Case for {@link AuthorizationAdminImpl}
+ *
+ * @author Roberto E. Escobar
+ */
+public class AuthorizationAdminImplTest {
+
+ private static final String DEFAULT_SCHEME = "none";
+ private static final String SCHEME_1 = "scheme1";
+ private static final String SCHEME_2 = "scheme2";
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ // @formatter:off
+ @Mock private Log logger;
+
+ @Mock private Authorization authorization;
+ @Mock private AuthorizationProvider provider1;
+ @Mock private AuthorizationProvider provider2;
+ // @formatter:on
+
+ private AuthorizationAdminImpl admin;
+
+ @Before
+ public void testSetup() {
+ initMocks(this);
+
+ admin = new AuthorizationAdminImpl();
+ admin.setLogger(logger);
+ admin.start(Collections.<String, Object> emptyMap());
+
+ when(provider1.getScheme()).thenReturn(SCHEME_1);
+ when(provider2.getScheme()).thenReturn(SCHEME_2);
+
+ admin.addAuthorizationProvider(new NoneAuthorizationProvider());
+ }
+
+ @Test
+ public void testAddRemoveProvider() {
+ Iterator<String> iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ admin.addAuthorizationProvider(provider1);
+ admin.addAuthorizationProvider(provider2);
+
+ iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(SCHEME_2, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ admin.removeAuthorizationProvider(provider1);
+
+ iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(SCHEME_2, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ admin.removeAuthorizationProvider(provider2);
+
+ iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(false, iterator.hasNext());
+ }
+
+ @Test
+ public void testAuthorizeSchemeAvailableButNotAllowed() {
+ admin.addAuthorizationProvider(provider1);
+
+ Iterator<String> iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ boolean actual = admin.isSchemeAllowed(DEFAULT_SCHEME);
+ assertEquals(false, actual);
+
+ actual = admin.isSchemeAllowed(SCHEME_1);
+ assertEquals(false, actual);
+
+ AuthorizationRequest request = AuthorizationRequestBuilder.newBuilder()//
+ .authorizationType(SCHEME_1) //
+ .build();
+
+ thrown.expect(OseeArgumentException.class);
+ thrown.expectMessage("Authorization Error - scheme [" + SCHEME_1 + "] is not allowed. Schemes available [].");
+ admin.authorize(request);
+ }
+
+ @Test
+ public void testAuthorizeSchemeAvailableButNoneNotAllowed() {
+ Iterator<String> iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ boolean actual = admin.isSchemeAllowed(DEFAULT_SCHEME);
+ assertEquals(false, actual);
+
+ AuthorizationRequest request = AuthorizationRequestBuilder.newBuilder()//
+ .build();
+
+ thrown.expect(OseeArgumentException.class);
+ thrown.expectMessage("Authorization Error - scheme [None] is not allowed. Schemes available [].");
+ admin.authorize(request);
+ }
+
+ @Test
+ public void testAuthorizeExceptionProviderReturnsNull() {
+ admin.addAuthorizationProvider(provider1);
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(AuthorizationConstants.AUTHORIZATION_OVERRIDE, AuthorizationOverride.NONE);
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, SCHEME_1);
+ admin.update(properties);
+
+ assertEquals(true, admin.isSchemeAllowed(SCHEME_1));
+
+ Date date = new Date();
+ AuthorizationRequest request = AuthorizationRequestBuilder.newBuilder()//
+ .date(date)//
+ .authorizationType(SCHEME_1) //
+ .secure(true) //
+ .build();
+
+ when(provider1.authorize(request)).thenReturn(null);
+
+ thrown.expect(OseeArgumentException.class);
+ thrown.expectMessage("Authentication Error - scheme [" + SCHEME_1 + "] returned null authorization");
+ admin.authorize(request);
+ }
+
+ @Test
+ public void testAuthorizeExceptionProviderWasNull() {
+ Date date = new Date();
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(AuthorizationConstants.AUTHORIZATION_OVERRIDE, AuthorizationOverride.NONE);
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, SCHEME_1);
+ admin.update(properties);
+
+ assertEquals(true, admin.isSchemeAllowed(SCHEME_1));
+
+ AuthorizationRequest request = AuthorizationRequestBuilder.newBuilder()//
+ .date(date)//
+ .authorizationType(SCHEME_1) //
+ .secure(true) //
+ .build();
+
+ thrown.expect(OseeArgumentException.class);
+ thrown.expectMessage("Authentication Error - scheme [" + SCHEME_1 + "] returned null provider");
+ admin.authorize(request);
+ }
+
+ @Test
+ public void testAuthorizeExceptionAuthorityWasNull() {
+ admin.addAuthorizationProvider(provider1);
+
+ Date date = new Date();
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(AuthorizationConstants.AUTHORIZATION_OVERRIDE, AuthorizationOverride.NONE);
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, SCHEME_1);
+ admin.update(properties);
+
+ assertEquals(true, admin.isSchemeAllowed(SCHEME_1));
+
+ AuthorizationRequest request = AuthorizationRequestBuilder.newBuilder()//
+ .date(date)//
+ .authorizationType(SCHEME_1) //
+ .secure(true) //
+ .build();
+
+ AuthorizationData data = Mockito.mock(AuthorizationData.class);
+
+ when(provider1.authorize(request)).thenReturn(data);
+
+ thrown.expect(OseeArgumentException.class);
+ thrown.expectMessage("Authentication Error - scheme [" + SCHEME_1 + "] returned null authority");
+ admin.authorize(request);
+ }
+
+ @Test
+ public void testGetAllowedSchemes() {
+ Iterator<String> iterator = admin.getAllowedSchemes().iterator();
+ assertEquals(false, iterator.hasNext());
+
+ admin.addAuthorizationProvider(provider1);
+
+ iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ iterator = admin.getAllowedSchemes().iterator();
+ assertEquals(false, iterator.hasNext());
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, SCHEME_1);
+ admin.update(properties);
+
+ iterator = admin.getAllowedSchemes().iterator();
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ }
+
+ @Test
+ public void testIsSchemeAllowed() {
+ admin.addAuthorizationProvider(provider1);
+ admin.addAuthorizationProvider(provider2);
+
+ Iterator<String> iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(SCHEME_2, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ boolean actual = admin.isSchemeAllowed(SCHEME_1);
+ assertEquals(false, actual);
+
+ actual = admin.isSchemeAllowed(SCHEME_2);
+ assertEquals(false, actual);
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, SCHEME_1);
+ admin.update(properties);
+
+ actual = admin.isSchemeAllowed(DEFAULT_SCHEME);
+ assertEquals(false, actual);
+
+ actual = admin.isSchemeAllowed(SCHEME_1);
+ assertEquals(true, actual);
+
+ actual = admin.isSchemeAllowed(SCHEME_2);
+ assertEquals(false, actual);
+
+ admin.update(properties);
+
+ actual = admin.isSchemeAllowed(SCHEME_1);
+ assertEquals(true, actual);
+
+ actual = admin.isSchemeAllowed(SCHEME_2);
+ assertEquals(false, actual);
+ }
+
+ @Test
+ public void testConfigUpdate() {
+ Iterator<String> iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ admin.update(properties);
+
+ iterator = admin.getAvailableSchemes().iterator();
+ assertEquals(DEFAULT_SCHEME, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, SCHEME_1 + "," + SCHEME_2);
+ admin.update(properties);
+
+ iterator = admin.getAllowedSchemes().iterator();
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(SCHEME_2, iterator.next());
+ assertEquals(false, iterator.hasNext());
+ }
+
+ @Test
+ public void testAuthorizeWithDefault() {
+ Date date = new Date();
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, DEFAULT_SCHEME);
+ admin.update(properties);
+
+ assertEquals(true, admin.isSchemeAllowed(DEFAULT_SCHEME));
+
+ AuthorizationRequest request = AuthorizationRequestBuilder.newBuilder()//
+ .date(date)//
+ .authorizationType(SCHEME_1) //
+ .secure(true) //
+ .build();
+
+ Authorization actual = admin.authorize(request);
+
+ assertEquals(date, actual.getCreationDate());
+ assertEquals(AuthorizationConstants.PERMIT_ALL_AUTHORIZER_SCHEME, actual.getScheme());
+ assertEquals(true, actual.isSecure());
+ assertEquals(null, actual.getPrincipal());
+ assertEquals(true, actual.isInRole(null));
+ assertEquals(true, actual.isInRole(""));
+ assertEquals(true, actual.isInRole("*"));
+ assertEquals(true, actual.isInRole("adssadadad"));
+ }
+
+ @Test
+ public void testAuthorizeWithProvider() {
+ admin.addAuthorizationProvider(provider1);
+
+ Date date = new Date();
+
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(AuthorizationConstants.AUTHORIZATION_OVERRIDE, AuthorizationOverride.NONE);
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, SCHEME_1);
+ admin.update(properties);
+
+ assertEquals(true, admin.isSchemeAllowed(SCHEME_1));
+
+ AuthorizationRequest request = AuthorizationRequestBuilder.newBuilder()//
+ .date(date)//
+ .authorizationType(SCHEME_1) //
+ .secure(true) //
+ .build();
+
+ AuthorizationData data = Mockito.mock(AuthorizationData.class);
+ Authority authority = Mockito.mock(Authority.class);
+ Principal principal = Mockito.mock(Principal.class);
+
+ when(provider1.authorize(request)).thenReturn(data);
+ when(data.getAuthority()).thenReturn(authority);
+ when(data.getPrincipal()).thenReturn(principal);
+
+ when(authority.getScheme()).thenReturn("authority");
+ when(authority.isInRole("okRole")).thenReturn(true);
+
+ Authorization actual = admin.authorize(request);
+
+ assertEquals(date, actual.getCreationDate());
+ assertEquals("authority", actual.getScheme());
+ assertEquals(true, actual.isSecure());
+ assertEquals(principal, actual.getPrincipal());
+ assertEquals(false, actual.isInRole(null));
+ assertEquals(false, actual.isInRole(""));
+ assertEquals(false, actual.isInRole("*"));
+ assertEquals(false, actual.isInRole("adssadadad"));
+ assertEquals(true, actual.isInRole("okRole"));
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/AuthorizationConfigurationBuilderTest.java b/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/AuthorizationConfigurationBuilderTest.java
new file mode 100644
index 0000000000..39b0419f9a
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/AuthorizationConfigurationBuilderTest.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.MockitoAnnotations.initMocks;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.osee.authorization.admin.AuthorizationConfiguration;
+import org.eclipse.osee.authorization.admin.AuthorizationConfigurationBuilder;
+import org.eclipse.osee.authorization.admin.AuthorizationConstants;
+import org.eclipse.osee.authorization.admin.AuthorizationOverride;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * Test Case for {@link AuthorizationConfigurationBuilder}
+ *
+ * @author Roberto E. Escobar
+ */
+public class AuthorizationConfigurationBuilderTest {
+
+ private static final String SCHEME_1 = "scheme1";
+ private static final String SCHEME_2 = "scheme2";
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private AuthorizationConfigurationBuilder builder;
+
+ @Before
+ public void testSetup() {
+ initMocks(this);
+
+ builder = AuthorizationConfigurationBuilder.newBuilder();
+ }
+
+ @Test
+ public void testOverride() {
+ builder.override(AuthorizationOverride.DENY_ALL);
+
+ AuthorizationConfiguration actual = builder.build();
+
+ assertEquals(AuthorizationOverride.DENY_ALL, actual.getOverride());
+ }
+
+ @Test
+ public void testAddSchemes() {
+ builder.scheme(SCHEME_1);
+ builder.scheme(SCHEME_2);
+
+ AuthorizationConfiguration actual = builder.build();
+
+ Iterator<String> iterator = actual.getAllowedSchemes().iterator();
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(SCHEME_2, iterator.next());
+ }
+
+ @Test
+ public void testConfigProperties() {
+ Map<String, Object> properties = new HashMap<String, Object>();
+ properties.put(AuthorizationConstants.AUTHORIZATION_OVERRIDE, AuthorizationOverride.DENY_ALL);
+ properties.put(AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED, SCHEME_2);
+ builder.properties(properties);
+
+ AuthorizationConfiguration actual = builder.build();
+
+ assertEquals(AuthorizationOverride.DENY_ALL, actual.getOverride());
+
+ Iterator<String> iterator = actual.getAllowedSchemes().iterator();
+ assertEquals(SCHEME_2, iterator.next());
+ }
+
+ @Test
+ public void testNoChangeAfterBuild() {
+ builder.override(AuthorizationOverride.DENY_ALL);
+ builder.scheme(SCHEME_1);
+
+ AuthorizationConfiguration actual = builder.build();
+
+ assertEquals(AuthorizationOverride.DENY_ALL, actual.getOverride());
+
+ Iterator<String> iterator = actual.getAllowedSchemes().iterator();
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(false, iterator.hasNext());
+
+ builder.override(AuthorizationOverride.PERMIT_ALL);
+ builder.scheme(SCHEME_2);
+
+ builder.build();
+
+ assertEquals(AuthorizationOverride.DENY_ALL, actual.getOverride());
+ iterator = actual.getAllowedSchemes().iterator();
+ assertEquals(SCHEME_1, iterator.next());
+ assertEquals(false, iterator.hasNext());
+ }
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/InternalTestSuite.java b/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/InternalTestSuite.java
new file mode 100644
index 0000000000..14a6d8318c
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin.test/src/org/eclipse/osee/authorization/admin/internal/InternalTestSuite.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({AuthorizationAdminImplTest.class, AuthorizationConfigurationBuilderTest.class})
+public class InternalTestSuite {
+ // Test Suite
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/.classpath b/plugins/org.eclipse.osee.authorization.admin/.classpath
new file mode 100644
index 0000000000..ad32c83a78
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.authorization.admin/.project b/plugins/org.eclipse.osee.authorization.admin/.project
new file mode 100644
index 0000000000..6fac01f755
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.authorization.admin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.authorization.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.authorization.admin/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..c909e79ec5
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Authorization Admin (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.authorization.admin
+Bundle-Version: 0.17.0.qualifier
+Bundle-Vendor: Eclipse Open System Engineering Environment
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Service-Component: OSGI-INF/*.xml
+Export-Package: org.eclipse.osee.authorization.admin
+Import-Package: org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.logger
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.osee.authorization.admin/OSGI-INF/authorization.admin.xml b/plugins/org.eclipse.osee.authorization.admin/OSGI-INF/authorization.admin.xml
new file mode 100644
index 0000000000..2b59539508
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/OSGI-INF/authorization.admin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" configuration-policy="optional" deactivate="stop" modified="update">
+ <implementation class="org.eclipse.osee.authorization.admin.internal.AuthorizationAdminImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.authorization.admin.AuthorizationAdmin"/>
+ </service>
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="addAuthorizationProvider" cardinality="0..n" interface="org.eclipse.osee.authorization.admin.AuthorizationProvider" name="AuthorizationProvider" policy="dynamic" unbind="removeAuthorizationProvider"/>
+ <property name="authorization.scheme.override" type="String" value="PERMIT_ALL"/>
+ <property name="authorization.scheme.allowed" type="String" value="None"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.authorization.admin/OSGI-INF/none.authorization.provider.xml b/plugins/org.eclipse.osee.authorization.admin/OSGI-INF/none.authorization.provider.xml
new file mode 100644
index 0000000000..553e69fbff
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/OSGI-INF/none.authorization.provider.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
+ <implementation class="org.eclipse.osee.authorization.admin.internal.NoneAuthorizationProvider"/>
+ <service>
+ <provide interface="org.eclipse.osee.authorization.admin.AuthorizationProvider"/>
+ </service>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.authorization.admin/build.properties b/plugins/org.eclipse.osee.authorization.admin/build.properties
new file mode 100644
index 0000000000..c58ea2178c
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
diff --git a/plugins/org.eclipse.osee.authorization.admin/pom.xml b/plugins/org.eclipse.osee.authorization.admin/pom.xml
new file mode 100644
index 0000000000..25ffae7b7d
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/pom.xml
@@ -0,0 +1,34 @@
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.osee</groupId>
+ <artifactId>org.eclipse.osee.x.core.parent</artifactId>
+ <version>0.17.0-SNAPSHOT</version>
+ <relativePath>../../plugins/org.eclipse.osee.x.core.parent</relativePath>
+ </parent>
+
+ <artifactId>org.eclipse.osee.authorization.admin</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>OSEE Authorization Admin - (Incubation)</name>
+
+ <build>
+ <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 -->
+ <resources>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-source-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/Authority.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/Authority.java
new file mode 100644
index 0000000000..490a454517
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/Authority.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface Authority {
+
+ String getScheme();
+
+ boolean isInRole(String role);
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/Authorization.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/Authorization.java
new file mode 100644
index 0000000000..be5d574f29
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/Authorization.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+import java.security.Principal;
+import java.util.Date;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface Authorization extends Authority {
+
+ Date getCreationDate();
+
+ boolean isSecure();
+
+ Principal getPrincipal();
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationAdmin.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationAdmin.java
new file mode 100644
index 0000000000..a7156afd20
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationAdmin.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface AuthorizationAdmin {
+
+ Authorization authorize(AuthorizationRequest request);
+
+ boolean isSchemeAllowed(String scheme);
+
+ Iterable<String> getAllowedSchemes();
+
+ Iterable<String> getAvailableSchemes();
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConfiguration.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConfiguration.java
new file mode 100644
index 0000000000..d95405fc41
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConfiguration.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface AuthorizationConfiguration {
+
+ AuthorizationOverride getOverride();
+
+ boolean hasOverride();
+
+ Iterable<String> getAllowedSchemes();
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConfigurationBuilder.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConfigurationBuilder.java
new file mode 100644
index 0000000000..c0936a081b
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConfigurationBuilder.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+import static org.eclipse.osee.authorization.admin.AuthorizationConstants.AUTHORIZATION_OVERRIDE;
+import static org.eclipse.osee.authorization.admin.AuthorizationConstants.AUTHORIZATION_SCHEME_ALLOWED;
+import static org.eclipse.osee.authorization.admin.AuthorizationConstants.DEFAULT_AUTHORIZATION_OVERRIDE;
+import static org.eclipse.osee.authorization.admin.AuthorizationConstants.DEFAULT_AUTHORIZATION_PROVIDER;
+import static org.eclipse.osee.authorization.admin.internal.AuthorizationUtil.unmodifiableSortedIterable;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.osee.authorization.admin.internal.AuthorizationUtil;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AuthorizationConfigurationBuilder {
+
+ private final AuthorizationConfigurationImpl config = new AuthorizationConfigurationImpl();
+
+ private AuthorizationConfigurationBuilder() {
+ //Builder class
+ }
+
+ public static AuthorizationConfigurationBuilder newBuilder() {
+ return new AuthorizationConfigurationBuilder();
+ }
+
+ public AuthorizationConfiguration build() {
+ return config.clone();
+ }
+
+ public AuthorizationConfigurationBuilder properties(Map<String, Object> props) {
+ config.loadProperties(props);
+ return this;
+ }
+
+ public AuthorizationConfigurationBuilder override(AuthorizationOverride override) {
+ config.setOverride(override);
+ return this;
+ }
+
+ public AuthorizationConfigurationBuilder scheme(String scheme) {
+ config.addScheme(scheme);
+ return this;
+ }
+
+ private static final class AuthorizationConfigurationImpl implements AuthorizationConfiguration, Cloneable {
+
+ private AuthorizationOverride override;
+ private final Set<String> schemes = new HashSet<String>();
+
+ @Override
+ public synchronized AuthorizationConfigurationImpl clone() {
+ AuthorizationConfigurationImpl cloned = new AuthorizationConfigurationImpl();
+ cloned.override = this.override;
+ cloned.addSchemes(this.schemes);
+ return cloned;
+ }
+
+ public void setOverride(AuthorizationOverride override) {
+ this.override = override;
+ }
+
+ @Override
+ public AuthorizationOverride getOverride() {
+ return override;
+ }
+
+ @Override
+ public boolean hasOverride() {
+ return override != null && AuthorizationOverride.NONE != override;
+ }
+
+ @Override
+ public Iterable<String> getAllowedSchemes() {
+ return unmodifiableSortedIterable(schemes);
+ }
+
+ public void addSchemes(Collection<String> toAdd) {
+ if (toAdd != null && !toAdd.isEmpty()) {
+ for (String scheme : toAdd) {
+ addScheme(scheme);
+ }
+ }
+ }
+
+ public void addScheme(String scheme) {
+ if (Strings.isValid(scheme)) {
+ schemes.add(AuthorizationUtil.normalize(scheme));
+ }
+ }
+
+ public void loadProperties(Map<String, Object> props) {
+ if (props != null && !props.isEmpty()) {
+ setOverride(getOverrideType(props, AUTHORIZATION_OVERRIDE, DEFAULT_AUTHORIZATION_OVERRIDE));
+ addSchemes(getSet(props, AUTHORIZATION_SCHEME_ALLOWED, DEFAULT_AUTHORIZATION_PROVIDER));
+ }
+ }
+
+ private AuthorizationOverride getOverrideType(Map<String, Object> props, String key, AuthorizationOverride defaultValue) {
+ String toReturn = get(props, key, defaultValue);
+ return AuthorizationOverride.parse(toReturn);
+ }
+
+ private Collection<String> getSet(Map<String, Object> props, String key, String defaultValue) {
+ Set<String> toReturn = new HashSet<String>();
+ String joinedArray = get(props, key, "");
+ if (Strings.isValid(joinedArray)) {
+ String[] split = joinedArray.split(",");
+ for (String value : split) {
+ String toAdd = AuthorizationUtil.normalize(value);
+ if (Strings.isValid(toAdd)) {
+ toReturn.add(toAdd);
+ }
+ }
+ } else {
+ toReturn.add(defaultValue);
+ }
+ return toReturn;
+ }
+
+ private String get(Map<String, Object> props, String key, Enum<?> defaultValue) {
+ return get(props, key, defaultValue != null ? defaultValue.name() : null);
+ }
+
+ private String get(Map<String, Object> props, String key, String defaultValue) {
+ String toReturn = defaultValue;
+ Object object = props.get(key);
+ if (object != null) {
+ toReturn = String.valueOf(object);
+ }
+ return toReturn;
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConstants.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConstants.java
new file mode 100644
index 0000000000..6c98e2bc7b
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationConstants.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+/**
+ * Class to collect configuration constants such as keys and default values.
+ *
+ * @author Roberto E. Escobar
+ */
+public final class AuthorizationConstants {
+
+ private AuthorizationConstants() {
+ // Constants class
+ }
+
+ public static final String NAMESPACE = "authorization";
+
+ private static String qualify(String value) {
+ return String.format("%s.%s", NAMESPACE, value);
+ }
+
+ public static final String DENY_ALL_AUTHORIZER_SCHEME = "Override - DenyAll";
+ public static final String PERMIT_ALL_AUTHORIZER_SCHEME = "Override - PermitAll";
+ public static final String NONE_AUTHORIZATION_PROVIDER = "None";
+
+ public static final AuthorizationOverride DEFAULT_AUTHORIZATION_OVERRIDE = AuthorizationOverride.PERMIT_ALL;
+ public static final String DEFAULT_AUTHORIZATION_PROVIDER = NONE_AUTHORIZATION_PROVIDER;
+
+ public static final String AUTHORIZATION_OVERRIDE = qualify("override");
+ public static final String AUTHORIZATION_SCHEME_ALLOWED = qualify("scheme.allowed");
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationData.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationData.java
new file mode 100644
index 0000000000..8eeb414567
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationData.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+import java.security.Principal;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface AuthorizationData {
+
+ String getScheme();
+
+ Principal getPrincipal();
+
+ Authority getAuthority();
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationOverride.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationOverride.java
new file mode 100644
index 0000000000..b6eedcb382
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationOverride.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public enum AuthorizationOverride {
+ NONE,
+ PERMIT_ALL,
+ DENY_ALL;
+
+ public static AuthorizationOverride parse(String value) {
+ AuthorizationOverride toReturn = AuthorizationOverride.NONE;
+ if (Strings.isValid(value)) {
+ String toFind = value.toUpperCase().trim();
+ for (AuthorizationOverride type : AuthorizationOverride.values()) {
+ if (type.name().equals(toFind)) {
+ toReturn = type;
+ break;
+ }
+ }
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationProvider.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationProvider.java
new file mode 100644
index 0000000000..0cb5a780fe
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationProvider.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface AuthorizationProvider {
+
+ String getScheme();
+
+ AuthorizationData authorize(AuthorizationRequest request);
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationRequest.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationRequest.java
new file mode 100644
index 0000000000..3c036b94a7
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationRequest.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+import java.util.Date;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface AuthorizationRequest {
+
+ boolean isSecure();
+
+ Date getRequestDate();
+
+ String getPath();
+
+ String getMethod();
+
+ String getAuthorizationType();
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationRequestBuilder.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationRequestBuilder.java
new file mode 100644
index 0000000000..da6869445c
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/AuthorizationRequestBuilder.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.authorization.admin;
+
+import java.util.Date;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class AuthorizationRequestBuilder {
+
+ private boolean isSecure;
+ private Date date;
+ private String path;
+ private String method;
+ private String authType;
+
+ private AuthorizationRequestBuilder() {
+ //
+ }
+
+ public static AuthorizationRequestBuilder newBuilder() {
+ return new AuthorizationRequestBuilder();
+ }
+
+ public AuthorizationRequest build() {
+ return new AuthorizationRequestImpl(isSecure, date, path, method, authType);
+ }
+
+ public AuthorizationRequestBuilder secure(boolean isSecure) {
+ this.isSecure = isSecure;
+ return this;
+ }
+
+ public AuthorizationRequestBuilder date(Date date) {
+ this.date = date;
+ return this;
+ }
+
+ public AuthorizationRequestBuilder method(String method) {
+ this.method = method;
+ return this;
+ }
+
+ public AuthorizationRequestBuilder path(String path) {
+ this.path = path;
+ return this;
+ }
+
+ public AuthorizationRequestBuilder authorizationType(String authType) {
+ this.authType = authType;
+ return this;
+ }
+
+ private static final class AuthorizationRequestImpl implements AuthorizationRequest {
+
+ private final boolean isSecure;
+ private final Date requestDate;
+ private final String path;
+ private final String method;
+ private final String authType;
+
+ public AuthorizationRequestImpl(boolean isSecure, Date requestDate, String path, String method, String authType) {
+ super();
+ this.isSecure = isSecure;
+ this.requestDate = requestDate;
+ this.path = path;
+ this.method = method;
+ this.authType = authType;
+ }
+
+ @Override
+ public boolean isSecure() {
+ return isSecure;
+ }
+
+ @Override
+ public Date getRequestDate() {
+ return requestDate;
+ }
+
+ @Override
+ public String getPath() {
+ return path;
+ }
+
+ @Override
+ public String getMethod() {
+ return method;
+ }
+
+ @Override
+ public String getAuthorizationType() {
+ return authType;
+ }
+
+ @Override
+ public String toString() {
+ return "AuthorizationRequestImpl [isSecure=" + isSecure + ", requestDate=" + requestDate + ", path=" + path + ", method=" + method + ", authType=" + authType + "]";
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationAdminImpl.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationAdminImpl.java
new file mode 100644
index 0000000000..5c01ee7b1a
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationAdminImpl.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import static org.eclipse.osee.authorization.admin.internal.AuthorizationUtil.normalize;
+import java.security.Principal;
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import org.eclipse.osee.authorization.admin.Authority;
+import org.eclipse.osee.authorization.admin.Authorization;
+import org.eclipse.osee.authorization.admin.AuthorizationAdmin;
+import org.eclipse.osee.authorization.admin.AuthorizationConfiguration;
+import org.eclipse.osee.authorization.admin.AuthorizationConfigurationBuilder;
+import org.eclipse.osee.authorization.admin.AuthorizationConstants;
+import org.eclipse.osee.authorization.admin.AuthorizationData;
+import org.eclipse.osee.authorization.admin.AuthorizationOverride;
+import org.eclipse.osee.authorization.admin.AuthorizationProvider;
+import org.eclipse.osee.authorization.admin.AuthorizationRequest;
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.logger.Log;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AuthorizationAdminImpl implements AuthorizationAdmin {
+
+ private static final Authority PERMIT_ALL_OVERRIDE = new PermitAllAuthority();
+ private static final Authority DENY_ALL_OVERRIDE = new DenyAllAuthority();
+
+ private final Map<String, AuthorizationProvider> providers = new ConcurrentHashMap<String, AuthorizationProvider>();
+
+ private Log logger;
+ private AuthorizationConfiguration config;
+
+ public void setLogger(Log logger) {
+ this.logger = logger;
+ }
+
+ public void start(Map<String, Object> properties) {
+ logger.trace("Starting AuthorizationAdminImpl...");
+ update(properties);
+ }
+
+ public void stop() {
+ logger.trace("Stopping AuthorizationAdminImpl...");
+ config = null;
+ }
+
+ public void update(Map<String, Object> properties) {
+ logger.trace("Updating AuthorizationAdminImpl...");
+
+ config = AuthorizationConfigurationBuilder.newBuilder()//
+ .properties(properties)//
+ .build();
+ }
+
+ public void addAuthorizationProvider(AuthorizationProvider provider) {
+ String providerId = provider.getScheme();
+ providerId = AuthorizationUtil.normalize(providerId);
+ providers.put(providerId, provider);
+ }
+
+ public void removeAuthorizationProvider(AuthorizationProvider provider) {
+ String providerId = provider.getScheme();
+ providerId = AuthorizationUtil.normalize(providerId);
+ providers.remove(providerId);
+ }
+
+ @Override
+ public Iterable<String> getAvailableSchemes() {
+ return AuthorizationUtil.unmodifiableSortedIterable(providers.keySet());
+ }
+
+ @Override
+ public Iterable<String> getAllowedSchemes() {
+ return config.getAllowedSchemes();
+ }
+
+ @Override
+ public boolean isSchemeAllowed(String schemeType) {
+ boolean isAllowed = false;
+ if (Strings.isValid(schemeType)) {
+ String toMatch = normalize(schemeType);
+ for (String scheme : getAllowedSchemes()) {
+ isAllowed = scheme.equals(toMatch);
+ if (isAllowed) {
+ break;
+ }
+ }
+ }
+ return isAllowed;
+ }
+
+ @Override
+ public Authorization authorize(AuthorizationRequest request) {
+ logger.debug("Authorization Requested: [%s]", request);
+
+ String scheme = getScheme(request);
+ checkSchemeAllowed(scheme);
+
+ AuthorizationProvider provider = getAuthorizationProvider(scheme);
+ checkProvider(scheme, provider);
+
+ AuthorizationData data = provider.authorize(request);
+ checkAuthorizationData(provider.getScheme(), data);
+
+ Authority authority = getAuthority(config.getOverride(), data);
+ checkAuthority(provider.getScheme(), authority);
+
+ String authScheme = authority.getScheme();
+ Date date = request.getRequestDate();
+ boolean secure = request.isSecure();
+ Principal principal = data != null ? data.getPrincipal() : null;
+ return new AuthorizationImpl(authScheme, date, secure, principal, authority);
+ }
+
+ private String getScheme(AuthorizationRequest request) {
+ String toReturn = request.getAuthorizationType();
+ if (!Strings.isValid(toReturn) || isNoneAllowed()) {
+ toReturn = AuthorizationConstants.NONE_AUTHORIZATION_PROVIDER;
+ }
+ return toReturn;
+ }
+
+ private boolean isNoneAllowed() {
+ boolean result = false;
+ String toFind = AuthorizationConstants.NONE_AUTHORIZATION_PROVIDER;
+ for (String allowed : getAllowedSchemes()) {
+ result = toFind.equalsIgnoreCase(allowed);
+ if (result) {
+ break;
+ }
+ }
+ return result;
+ }
+
+ private AuthorizationProvider getAuthorizationProvider(String scheme) {
+ String toGet = normalize(scheme);
+ return providers.get(toGet);
+ }
+
+ private Authority getAuthority(AuthorizationOverride override, AuthorizationData data) {
+ Authority toReturn = null;
+ switch (override) {
+ case DENY_ALL:
+ toReturn = DENY_ALL_OVERRIDE;
+ break;
+ case PERMIT_ALL:
+ toReturn = PERMIT_ALL_OVERRIDE;
+ break;
+ default:
+ toReturn = data.getAuthority();
+ break;
+ }
+ return toReturn;
+ }
+
+ private void checkSchemeAllowed(String schemeType) {
+ Conditions.checkExpressionFailOnTrue(!isSchemeAllowed(schemeType),
+ "Authorization Error - scheme [%s] is not allowed. Schemes available %s.", schemeType, getAllowedSchemes());
+ }
+
+ private void checkProvider(String scheme, AuthorizationProvider provider) {
+ Conditions.checkExpressionFailOnTrue(provider == null,
+ "Authentication Error - scheme [%s] returned null provider", scheme);
+ }
+
+ private void checkAuthorizationData(String scheme, AuthorizationData data) {
+ Conditions.checkExpressionFailOnTrue(data == null,
+ "Authentication Error - scheme [%s] returned null authorization", scheme);
+ }
+
+ private void checkAuthority(String scheme, Authority data) {
+ Conditions.checkExpressionFailOnTrue(data == null, "Authentication Error - scheme [%s] returned null authority",
+ scheme);
+ }
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationImpl.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationImpl.java
new file mode 100644
index 0000000000..8398f167ea
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationImpl.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import java.security.Principal;
+import java.util.Date;
+import org.eclipse.osee.authorization.admin.Authority;
+import org.eclipse.osee.authorization.admin.Authorization;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AuthorizationImpl implements Authorization {
+
+ private final String scheme;
+ private final Date date;
+ private final boolean secure;
+ private final Principal principal;
+ private final Authority authority;
+
+ public AuthorizationImpl(String scheme, Date date, boolean secure, Principal principal, Authority authority) {
+ super();
+ this.scheme = scheme;
+ this.date = date;
+ this.secure = secure;
+ this.principal = principal;
+ this.authority = authority;
+ }
+
+ @Override
+ public boolean isInRole(String role) {
+ return authority.isInRole(role);
+ }
+
+ @Override
+ public String getScheme() {
+ return scheme;
+ }
+
+ @Override
+ public Date getCreationDate() {
+ return date;
+ }
+
+ @Override
+ public boolean isSecure() {
+ return secure;
+ }
+
+ @Override
+ public Principal getPrincipal() {
+ return principal;
+ }
+
+ @Override
+ public String toString() {
+ return "AuthorizationImpl [scheme=" + scheme + ", date=" + date + ", secure=" + secure + ", principal=" + principal + "]";
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationUtil.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationUtil.java
new file mode 100644
index 0000000000..6dff7b922f
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/AuthorizationUtil.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class AuthorizationUtil {
+
+ private AuthorizationUtil() {
+ //
+ }
+
+ public static String normalize(String value) {
+ return Strings.isValid(value) ? value.toLowerCase().trim() : value;
+ }
+
+ public static Iterable<String> unmodifiableSortedIterable(Collection<String> source) {
+ List<String> list = new ArrayList<String>();
+ list.addAll(source);
+ Collections.sort(list);
+ return Collections.unmodifiableList(list);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/DenyAllAuthority.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/DenyAllAuthority.java
new file mode 100644
index 0000000000..fa572258e7
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/DenyAllAuthority.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import org.eclipse.osee.authorization.admin.AuthorizationConstants;
+import org.eclipse.osee.authorization.admin.Authority;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DenyAllAuthority implements Authority {
+
+ @Override
+ public String getScheme() {
+ return AuthorizationConstants.DENY_ALL_AUTHORIZER_SCHEME;
+ }
+
+ @Override
+ public boolean isInRole(String role) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/NoneAuthorizationProvider.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/NoneAuthorizationProvider.java
new file mode 100644
index 0000000000..36074d5bda
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/NoneAuthorizationProvider.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import java.security.Principal;
+import org.eclipse.osee.authorization.admin.Authority;
+import org.eclipse.osee.authorization.admin.AuthorizationConstants;
+import org.eclipse.osee.authorization.admin.AuthorizationData;
+import org.eclipse.osee.authorization.admin.AuthorizationProvider;
+import org.eclipse.osee.authorization.admin.AuthorizationRequest;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class NoneAuthorizationProvider implements AuthorizationProvider, AuthorizationData, Authority {
+
+ @Override
+ public String getScheme() {
+ return AuthorizationConstants.NONE_AUTHORIZATION_PROVIDER;
+ }
+
+ @Override
+ public Principal getPrincipal() {
+ return null;
+ }
+
+ @Override
+ public Authority getAuthority() {
+ return this;
+ }
+
+ @Override
+ public AuthorizationData authorize(AuthorizationRequest request) {
+ return this;
+ }
+
+ @Override
+ public boolean isInRole(String role) {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/PermitAllAuthority.java b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/PermitAllAuthority.java
new file mode 100644
index 0000000000..667c3817e8
--- /dev/null
+++ b/plugins/org.eclipse.osee.authorization.admin/src/org/eclipse/osee/authorization/admin/internal/PermitAllAuthority.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.authorization.admin.internal;
+
+import org.eclipse.osee.authorization.admin.AuthorizationConstants;
+import org.eclipse.osee.authorization.admin.Authority;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class PermitAllAuthority implements Authority {
+
+ @Override
+ public String getScheme() {
+ return AuthorizationConstants.PERMIT_ALL_AUTHORIZER_SCHEME;
+ }
+
+ @Override
+ public boolean isInRole(String role) {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.authorization/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.authorization/META-INF/MANIFEST.MF
deleted file mode 100644
index 1c7ea5d3db..0000000000
--- a/plugins/org.eclipse.osee.authorization/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: OSEE Authorization
-Bundle-SymbolicName: org.eclipse.osee.authorization
-Bundle-Version: 0.17.0.qualifier
-Bundle-Vendor: Eclipse Open System Engineering Environment
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.osgi.framework;version="1.3.0"
diff --git a/plugins/org.eclipse.osee.authorization/src/org/eclipse/osee/authorization/placeholder.txt b/plugins/org.eclipse.osee.authorization/src/org/eclipse/osee/authorization/placeholder.txt
deleted file mode 100644
index e69de29bb2..0000000000
--- a/plugins/org.eclipse.osee.authorization/src/org/eclipse/osee/authorization/placeholder.txt
+++ /dev/null
diff --git a/plugins/org.eclipse.osee.x.core.parent/pom.xml b/plugins/org.eclipse.osee.x.core.parent/pom.xml
index d43454f632..7c71ff903a 100644
--- a/plugins/org.eclipse.osee.x.core.parent/pom.xml
+++ b/plugins/org.eclipse.osee.x.core.parent/pom.xml
@@ -38,7 +38,10 @@
<module>../../plugins/org.eclipse.osee.authentication.admin</module>
<module>../../plugins/org.eclipse.osee.authentication.admin.test</module>
-
+
+ <module>../../plugins/org.eclipse.osee.authorization.admin</module>
+ <module>../../plugins/org.eclipse.osee.authorization.admin.test</module>
+
<module>../../plugins/org.eclipse.osee.authentication.ldap</module>
<module>../../plugins/org.eclipse.osee.authentication.ldap.test</module>

Back to the top