You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2016/07/14 22:33:12 UTC
[06/10] nifi git commit: NIFI-1896 This closes #650. Refactored
nifi-api into nifi-framework-api and other locations. The nifi-api is
specific to that which is needed for intended extension points.
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebRequestContext.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebRequestContext.java b/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebRequestContext.java
deleted file mode 100644
index 9dd44ab..0000000
--- a/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebRequestContext.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.web;
-
-/**
- * Contextual details required to make a request from a UI extension.
- */
-public interface NiFiWebRequestContext {
-
- /**
- * @return the type of UI extension is making the request
- */
- UiExtensionType getExtensionType();
-
- /**
- * The request protocol scheme (http or https). When scheme is https, the
- * X509Certificate can be used for subsequent remote requests.
- *
- * @return the protocol scheme
- */
- String getScheme();
-
- /**
- * The id of the component.
- *
- * @return the ID
- */
- String getId();
-
- /**
- * Returns the proxied entities chain. The format of the chain is as
- * follows:
- *
- * <code>
- * <CN=original-proxied-entity><CN=first-proxy><CN=second-proxy>...
- * </code>
- *
- * @return the proxied entities chain or null if no chain
- */
- String getProxiedEntitiesChain();
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/main/java/org/apache/nifi/web/ResourceNotFoundException.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/web/ResourceNotFoundException.java b/nifi-api/src/main/java/org/apache/nifi/web/ResourceNotFoundException.java
deleted file mode 100644
index b2f2e57..0000000
--- a/nifi-api/src/main/java/org/apache/nifi/web/ResourceNotFoundException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.web;
-
-/**
- * Exception indicating that the desired resource was not found.
- */
-@SuppressWarnings("serial")
-public class ResourceNotFoundException extends RuntimeException {
-
- public ResourceNotFoundException(String message) {
- super(message);
- }
-
- public ResourceNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/main/java/org/apache/nifi/web/Revision.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/web/Revision.java b/nifi-api/src/main/java/org/apache/nifi/web/Revision.java
deleted file mode 100644
index d768faa..0000000
--- a/nifi-api/src/main/java/org/apache/nifi/web/Revision.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.web;
-
-import java.io.Serializable;
-
-/**
- * A model object representing a revision. Equality is defined as matching
- * component ID and either a matching version number or matching non-empty client IDs.
- *
- * @Immutable
- * @Threadsafe
- */
-public class Revision implements Serializable {
- private static final long serialVersionUID = 988658790374170022L;
-
- /**
- * the version number
- */
- private final Long version;
-
- /**
- * the client ID
- */
- private final String clientId;
-
- /**
- * the ID of the component that this revision belongs to, or <code>null</code> if
- * the revision is not attached to any component but rather is attached to the entire
- * data flow.
- */
- private final String componentId;
-
- public Revision(Long version, String clientId, String componentId) {
- if (version == null) {
- throw new IllegalArgumentException("The revision must be specified.");
- }
- if (componentId == null) {
- throw new IllegalArgumentException("The componentId must be specified.");
- }
-
- this.version = version;
- this.clientId = clientId;
- this.componentId = componentId;
- }
-
- public String getClientId() {
- return clientId;
- }
-
- public Long getVersion() {
- return version;
- }
-
- public String getComponentId() {
- return componentId;
- }
-
- /**
- * Returns a new Revision that has the same Client ID and Component ID as this one
- * but with a larger version
- *
- * @return the updated Revision
- */
- public Revision incrementRevision(final String clientId) {
- return new Revision(version + 1, clientId, componentId);
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) {
- return false;
- }
- if (obj == this) {
- return true;
- }
-
- if ((obj instanceof Revision) == false) {
- return false;
- }
-
- Revision thatRevision = (Revision) obj;
- // ensure that component ID's are the same (including null)
- if (thatRevision.getComponentId() == null && getComponentId() != null) {
- return false;
- }
- if (thatRevision.getComponentId() != null && getComponentId() == null) {
- return false;
- }
- if (thatRevision.getComponentId() != null && !thatRevision.getComponentId().equals(getComponentId())) {
- return false;
- }
-
- if (this.version != null && this.version.equals(thatRevision.version)) {
- return true;
- } else {
- return clientId != null && !clientId.trim().isEmpty() && clientId.equals(thatRevision.getClientId());
- }
-
- }
-
- @Override
- public int hashCode() {
- int hash = 5;
- hash = 59 * hash + (this.componentId != null ? this.componentId.hashCode() : 0);
- hash = 59 * hash + (this.version != null ? this.version.hashCode() : 0);
- hash = 59 * hash + (this.clientId != null ? this.clientId.hashCode() : 0);
- return hash;
- }
-
- @Override
- public String toString() {
- return "[" + version + ", " + clientId + ", " + componentId + ']';
- }
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/main/java/org/apache/nifi/web/UiExtensionType.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/web/UiExtensionType.java b/nifi-api/src/main/java/org/apache/nifi/web/UiExtensionType.java
deleted file mode 100644
index e3b0f8a..0000000
--- a/nifi-api/src/main/java/org/apache/nifi/web/UiExtensionType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.web;
-
-/**
- * Types of UI extensions. Since a UI extension could support multiple types of
- * custom UIs it will need to include the type so the framework can appropriate
- * understand and process the request (recording actions in the audit database,
- * replicating a request throughout the cluster to the appropriate endpoints,
- * etc).
- */
-public enum UiExtensionType {
-
- ContentViewer,
- ProcessorConfiguration,
- ControllerServiceConfiguration,
- ReportingTaskConfiguration
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/main/java/org/apache/nifi/web/ViewableContent.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/main/java/org/apache/nifi/web/ViewableContent.java b/nifi-api/src/main/java/org/apache/nifi/web/ViewableContent.java
deleted file mode 100644
index d506b5d..0000000
--- a/nifi-api/src/main/java/org/apache/nifi/web/ViewableContent.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.web;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Interface for obtaining content from the NiFi content repository.
- */
-public interface ViewableContent {
-
- public static final String CONTENT_REQUEST_ATTRIBUTE = "org.apache.nifi.web.content";
-
- public enum DisplayMode {
-
- Original,
- Formatted,
- Hex;
- }
-
- /**
- * @return stream to the viewable content. The data stream can only be read once
- * so an extension can call this method or getContent
- */
- InputStream getContentStream();
-
- /**
- * @return the content as a string. The data stream can only be read once so an
- * extension can call this method or getContentStream
- * @throws java.io.IOException if unable to read content
- */
- String getContent() throws IOException;
-
- /**
- * @return the desired display mode. If the mode is Hex the framework will
- * handle generating the mark up. The only values that an extension will see
- * is Original or Formatted
- */
- DisplayMode getDisplayMode();
-
- /**
- * @return contents file name
- */
- String getFileName();
-
- /**
- * @return mime type of the content, value is lowercase and stripped of all parameters if there were any
- */
- String getContentType();
-
- /**
- * @return unchanged mime type of the content
- */
- String getRawContentType();
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/test/java/org/apache/nifi/authorization/TestAbstractPolicyBasedAuthorizer.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/test/java/org/apache/nifi/authorization/TestAbstractPolicyBasedAuthorizer.java b/nifi-api/src/test/java/org/apache/nifi/authorization/TestAbstractPolicyBasedAuthorizer.java
deleted file mode 100644
index b173d3d..0000000
--- a/nifi-api/src/test/java/org/apache/nifi/authorization/TestAbstractPolicyBasedAuthorizer.java
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.authorization;
-
-import org.apache.nifi.authorization.exception.AuthorizationAccessException;
-import org.apache.nifi.authorization.exception.AuthorizerCreationException;
-import org.apache.nifi.authorization.exception.AuthorizerDestructionException;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-
-public class TestAbstractPolicyBasedAuthorizer {
-
- static final Resource TEST_RESOURCE = new Resource() {
- @Override
- public String getIdentifier() {
- return "1";
- }
-
- @Override
- public String getName() {
- return "resource1";
- }
- };
-
- @Test
- public void testApproveBasedOnUser() {
- AbstractPolicyBasedAuthorizer authorizer = Mockito.mock(AbstractPolicyBasedAuthorizer.class);
- UsersAndAccessPolicies usersAndAccessPolicies = Mockito.mock(UsersAndAccessPolicies.class);
- when(authorizer.getUsersAndAccessPolicies()).thenReturn(usersAndAccessPolicies);
-
- final String userIdentifier = "userIdentifier1";
- final String userIdentity = "userIdentity1";
-
- final AccessPolicy policy = new AccessPolicy.Builder()
- .identifier("1")
- .resource(TEST_RESOURCE.getIdentifier())
- .addUser(userIdentifier)
- .action(RequestAction.READ)
- .build();
-
- when(usersAndAccessPolicies.getAccessPolicy(TEST_RESOURCE.getIdentifier(), RequestAction.READ)).thenReturn(policy);
-
- final User user = new User.Builder()
- .identity(userIdentity)
- .identifier(userIdentifier)
- .build();
-
- when(usersAndAccessPolicies.getUser(userIdentity)).thenReturn(user);
-
- final AuthorizationRequest request = new AuthorizationRequest.Builder()
- .identity(userIdentity)
- .resource(TEST_RESOURCE)
- .action(RequestAction.READ)
- .accessAttempt(true)
- .anonymous(false)
- .build();
-
- assertEquals(AuthorizationResult.approved(), authorizer.authorize(request));
- }
-
- @Test
- public void testApprovedBasedOnGroup() {
- AbstractPolicyBasedAuthorizer authorizer = Mockito.mock(AbstractPolicyBasedAuthorizer.class);
- UsersAndAccessPolicies usersAndAccessPolicies = Mockito.mock(UsersAndAccessPolicies.class);
- when(authorizer.getUsersAndAccessPolicies()).thenReturn(usersAndAccessPolicies);
-
- final String userIdentifier = "userIdentifier1";
- final String userIdentity = "userIdentity1";
- final String groupIdentifier = "groupIdentifier1";
-
- final AccessPolicy policy = new AccessPolicy.Builder()
- .identifier("1")
- .resource(TEST_RESOURCE.getIdentifier())
- .addGroup(groupIdentifier)
- .action(RequestAction.READ)
- .build();
-
- when(usersAndAccessPolicies.getAccessPolicy(TEST_RESOURCE.getIdentifier(), RequestAction.READ)).thenReturn(policy);
-
- final User user = new User.Builder()
- .identity(userIdentity)
- .identifier(userIdentifier)
- .build();
-
- when(usersAndAccessPolicies.getUser(userIdentity)).thenReturn(user);
-
- final Group group = new Group.Builder()
- .identifier(groupIdentifier)
- .name(groupIdentifier)
- .addUser(user.getIdentifier())
- .build();
-
- when(usersAndAccessPolicies.getGroups(userIdentity)).thenReturn(Collections.singleton(group));
-
- final AuthorizationRequest request = new AuthorizationRequest.Builder()
- .identity(userIdentity)
- .resource(TEST_RESOURCE)
- .action(RequestAction.READ)
- .accessAttempt(true)
- .anonymous(false)
- .build();
-
- assertEquals(AuthorizationResult.approved(), authorizer.authorize(request));
- }
-
- @Test
- public void testDeny() {
- AbstractPolicyBasedAuthorizer authorizer = Mockito.mock(AbstractPolicyBasedAuthorizer.class);
- UsersAndAccessPolicies usersAndAccessPolicies = Mockito.mock(UsersAndAccessPolicies.class);
- when(authorizer.getUsersAndAccessPolicies()).thenReturn(usersAndAccessPolicies);
-
- final String userIdentifier = "userIdentifier1";
- final String userIdentity = "userIdentity1";
-
- final AccessPolicy policy = new AccessPolicy.Builder()
- .identifier("1")
- .resource(TEST_RESOURCE.getIdentifier())
- .addUser("NOT_USER_1")
- .action(RequestAction.READ)
- .build();
-
- when(usersAndAccessPolicies.getAccessPolicy(TEST_RESOURCE.getIdentifier(), RequestAction.READ)).thenReturn(policy);
-
- final User user = new User.Builder()
- .identity(userIdentity)
- .identifier(userIdentifier)
- .build();
-
- when(usersAndAccessPolicies.getUser(userIdentity)).thenReturn(user);
-
- final AuthorizationRequest request = new AuthorizationRequest.Builder()
- .identity(userIdentity)
- .resource(TEST_RESOURCE)
- .action(RequestAction.READ)
- .accessAttempt(true)
- .anonymous(false)
- .build();
-
- assertEquals(AuthorizationResult.denied().getResult(), authorizer.authorize(request).getResult());
- }
-
- @Test
- public void testResourceNotFound() {
- AbstractPolicyBasedAuthorizer authorizer = Mockito.mock(AbstractPolicyBasedAuthorizer.class);
- UsersAndAccessPolicies usersAndAccessPolicies = Mockito.mock(UsersAndAccessPolicies.class);
- when(authorizer.getUsersAndAccessPolicies()).thenReturn(usersAndAccessPolicies);
-
- when(usersAndAccessPolicies.getAccessPolicy(TEST_RESOURCE.getIdentifier(), RequestAction.READ)).thenReturn(null);
-
- final AuthorizationRequest request = new AuthorizationRequest.Builder()
- .identity("userIdentity")
- .resource(TEST_RESOURCE)
- .action(RequestAction.READ)
- .accessAttempt(true)
- .anonymous(false)
- .build();
-
- assertEquals(AuthorizationResult.resourceNotFound(), authorizer.authorize(request));
- }
-
- @Test
- public void testGetFingerprint() {
- // create the users, groups, and policies
-
- User user1 = new User.Builder().identifier("user-id-1").identity("user-1").build();
- User user2 = new User.Builder().identifier("user-id-2").identity("user-2").build();
-
- Group group1 = new Group.Builder().identifier("group-id-1").name("group-1").addUser(user1.getIdentifier()).build();
- Group group2 = new Group.Builder().identifier("group-id-2").name("group-2").addUser(user2.getIdentifier()).build();
-
- AccessPolicy policy1 = new AccessPolicy.Builder()
- .identifier("policy-id-1")
- .resource("resource1")
- .action(RequestAction.READ)
- .addUser(user1.getIdentifier())
- .addUser(user2.getIdentifier())
- .build();
-
- AccessPolicy policy2 = new AccessPolicy.Builder()
- .identifier("policy-id-2")
- .resource("resource2")
- .action(RequestAction.READ)
- .addGroup(group1.getIdentifier())
- .addGroup(group2.getIdentifier())
- .addUser(user1.getIdentifier())
- .addUser(user2.getIdentifier())
- .build();
-
- // create the first Authorizer
-
- Set<Group> groups1 = new LinkedHashSet<>();
- groups1.add(group1);
- groups1.add(group2);
-
- Set<User> users1 = new LinkedHashSet<>();
- users1.add(user1);
- users1.add(user2);
-
- Set<AccessPolicy> policies1 = new LinkedHashSet<>();
- policies1.add(policy1);
- policies1.add(policy2);
-
- AbstractPolicyBasedAuthorizer authorizer1 = Mockito.mock(AbstractPolicyBasedAuthorizer.class);
- when(authorizer1.getGroups()).thenReturn(groups1);
- when(authorizer1.getUsers()).thenReturn(users1);
- when(authorizer1.getAccessPolicies()).thenReturn(policies1);
-
- // create the second Authorizer
-
- Set<Group> groups2 = new LinkedHashSet<>();
- groups2.add(group2);
- groups2.add(group1);
-
- Set<User> users2 = new LinkedHashSet<>();
- users2.add(user2);
- users2.add(user1);
-
- Set<AccessPolicy> policies2 = new LinkedHashSet<>();
- policies2.add(policy2);
- policies2.add(policy1);
-
- AbstractPolicyBasedAuthorizer authorizer2 = Mockito.mock(AbstractPolicyBasedAuthorizer.class);
- when(authorizer2.getGroups()).thenReturn(groups2);
- when(authorizer2.getUsers()).thenReturn(users2);
- when(authorizer2.getAccessPolicies()).thenReturn(policies2);
-
- // compare the fingerprints
-
- assertEquals(authorizer1.getFingerprint(), authorizer2.getFingerprint());
-
- System.out.println(authorizer1.getFingerprint());
- }
-
- @Test
- public void testInheritFingerprint() {
-
- User user1 = new User.Builder().identifier("user-id-1").identity("user-1").build();
- User user2 = new User.Builder().identifier("user-id-2").identity("user-2").build();
-
- Group group1 = new Group.Builder().identifier("group-id-1").name("group-1").addUser(user1.getIdentifier()).build();
- Group group2 = new Group.Builder().identifier("group-id-2").name("group-2").build();
-
- AccessPolicy policy1 = new AccessPolicy.Builder()
- .identifier("policy-id-1")
- .resource("resource1")
- .action(RequestAction.READ)
- .addUser(user1.getIdentifier())
- .addUser(user2.getIdentifier())
- .build();
-
- AccessPolicy policy2 = new AccessPolicy.Builder()
- .identifier("policy-id-2")
- .resource("resource2")
- .action(RequestAction.READ)
- .addGroup(group1.getIdentifier())
- .addGroup(group2.getIdentifier())
- .addUser(user1.getIdentifier())
- .addUser(user2.getIdentifier())
- .build();
-
- // create the first Authorizer
-
- Set<Group> groups1 = new LinkedHashSet<>();
- groups1.add(group1);
- groups1.add(group2);
-
- Set<User> users1 = new LinkedHashSet<>();
- users1.add(user1);
- users1.add(user2);
-
- Set<AccessPolicy> policies1 = new LinkedHashSet<>();
- policies1.add(policy1);
- policies1.add(policy2);
-
- AbstractPolicyBasedAuthorizer authorizer1 = Mockito.mock(AbstractPolicyBasedAuthorizer.class);
- when(authorizer1.getGroups()).thenReturn(groups1);
- when(authorizer1.getUsers()).thenReturn(users1);
- when(authorizer1.getAccessPolicies()).thenReturn(policies1);
-
- final String fingerprint1 = authorizer1.getFingerprint();
-
- // make a second authorizer using the memory-backed implementation so we can inherit the fingerprint
- // and then compute a new fingerprint to compare them
- AbstractPolicyBasedAuthorizer authorizer2 = new MemoryPolicyBasedAuthorizer();
- authorizer2.inheritFingerprint(fingerprint1);
-
- // computer the fingerprint of the second authorizer and it should be the same as the first
- final String fingerprint2 = authorizer2.getFingerprint();
- assertEquals(fingerprint1, fingerprint2);
-
- // all the sets should be equal now after inheriting
- assertEquals(authorizer1.getUsers(), authorizer2.getUsers());
- assertEquals(authorizer1.getGroups(), authorizer2.getGroups());
- assertEquals(authorizer1.getAccessPolicies(), authorizer2.getAccessPolicies());
- }
-
- @Test
- public void testEmptyAuthorizer() {
- AbstractPolicyBasedAuthorizer authorizer = Mockito.mock(AbstractPolicyBasedAuthorizer.class);
- when(authorizer.getGroups()).thenReturn(new HashSet<Group>());
- when(authorizer.getUsers()).thenReturn(new HashSet<User>());
- when(authorizer.getAccessPolicies()).thenReturn(new HashSet<AccessPolicy>());
-
- final String fingerprint = authorizer.getFingerprint();
- Assert.assertNotNull(fingerprint);
- Assert.assertTrue(fingerprint.length() > 0);
- }
-
- /**
- * An AbstractPolicyBasedAuthorizer that stores everything in memory.
- */
- private static final class MemoryPolicyBasedAuthorizer extends AbstractPolicyBasedAuthorizer {
-
- private Set<Group> groups = new HashSet<>();
- private Set<User> users = new HashSet<>();
- private Set<AccessPolicy> policies = new HashSet<>();
-
- @Override
- public Group addGroup(Group group) throws AuthorizationAccessException {
- groups.add(group);
- return group;
- }
-
- @Override
- public Group getGroup(String identifier) throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Group updateGroup(Group group) throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Group deleteGroup(Group group) throws AuthorizationAccessException {
- groups.remove(group);
- return group;
- }
-
- @Override
- public Set<Group> getGroups() throws AuthorizationAccessException {
- return groups;
- }
-
- @Override
- public User addUser(User user) throws AuthorizationAccessException {
- users.add(user);
- return user;
- }
-
- @Override
- public User getUser(String identifier) throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public User getUserByIdentity(String identity) throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public User updateUser(User user) throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public User deleteUser(User user) throws AuthorizationAccessException {
- users.remove(user);
- return user;
- }
-
- @Override
- public Set<User> getUsers() throws AuthorizationAccessException {
- return users;
- }
-
- @Override
- protected AccessPolicy doAddAccessPolicy(AccessPolicy accessPolicy) throws AuthorizationAccessException {
- policies.add(accessPolicy);
- return accessPolicy;
- }
-
- @Override
- public AccessPolicy getAccessPolicy(String identifier) throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public AccessPolicy updateAccessPolicy(AccessPolicy accessPolicy) throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public AccessPolicy deleteAccessPolicy(AccessPolicy policy) throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Set<AccessPolicy> getAccessPolicies() throws AuthorizationAccessException {
- return policies;
- }
-
- @Override
- public UsersAndAccessPolicies getUsersAndAccessPolicies() throws AuthorizationAccessException {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void initialize(AuthorizerInitializationContext initializationContext) throws AuthorizerCreationException {
-
- }
-
- @Override
- public void doOnConfigured(AuthorizerConfigurationContext configurationContext) throws AuthorizerCreationException {
-
- }
-
- @Override
- public void preDestruction() throws AuthorizerDestructionException {
-
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/test/java/org/apache/nifi/authorization/TestAccessPolicy.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/test/java/org/apache/nifi/authorization/TestAccessPolicy.java b/nifi-api/src/test/java/org/apache/nifi/authorization/TestAccessPolicy.java
deleted file mode 100644
index c8a4452..0000000
--- a/nifi-api/src/test/java/org/apache/nifi/authorization/TestAccessPolicy.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.authorization;
-
-import org.junit.Test;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class TestAccessPolicy {
-
- static final String TEST_RESOURCE = "1";
-
- @Test
- public void testSimpleCreation() {
- final String identifier = "1";
- final String user1 = "user1";
- final String user2 = "user2";
- final RequestAction action = RequestAction.READ;
-
- final AccessPolicy policy = new AccessPolicy.Builder()
- .identifier(identifier)
- .resource(TEST_RESOURCE)
- .addUser(user1)
- .addUser(user2)
- .action(action)
- .build();
-
- assertEquals(identifier, policy.getIdentifier());
-
- assertNotNull(policy.getResource());
- assertEquals(TEST_RESOURCE, policy.getResource());
-
- assertNotNull(policy.getUsers());
- assertEquals(2, policy.getUsers().size());
- assertTrue(policy.getUsers().contains(user1));
- assertTrue(policy.getUsers().contains(user2));
-
- assertNotNull(policy.getAction());
- assertEquals(RequestAction.READ, policy.getAction());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testMissingIdentifier() {
- new AccessPolicy.Builder()
- .resource(TEST_RESOURCE)
- .addUser("user1")
- .action(RequestAction.READ)
- .build();
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testMissingResource() {
- new AccessPolicy.Builder()
- .identifier("1")
- .addUser("user1")
- .action(RequestAction.READ)
- .build();
- }
-
- @Test
- public void testMissingUsersAndGroups() {
- final AccessPolicy policy = new AccessPolicy.Builder()
- .identifier("1")
- .resource(TEST_RESOURCE)
- .action(RequestAction.READ)
- .build();
-
- assertNotNull(policy);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testMissingActions() {
- new AccessPolicy.Builder()
- .identifier("1")
- .resource(TEST_RESOURCE)
- .addUser("user1")
- .build();
- }
-
- @Test
- public void testFromPolicy() {
- final String identifier = "1";
- final String user1 = "user1";
- final String user2 = "user2";
- final String group1 = "group1";
- final String group2 = "group2";
- final RequestAction action = RequestAction.READ;
-
- final AccessPolicy policy = new AccessPolicy.Builder()
- .identifier(identifier)
- .resource(TEST_RESOURCE)
- .addUser(user1)
- .addUser(user2)
- .addGroup(group1)
- .addGroup(group2)
- .action(action)
- .build();
-
- assertEquals(identifier, policy.getIdentifier());
-
- assertNotNull(policy.getResource());
- assertEquals(TEST_RESOURCE, policy.getResource());
-
- assertNotNull(policy.getUsers());
- assertEquals(2, policy.getUsers().size());
- assertTrue(policy.getUsers().contains(user1));
- assertTrue(policy.getUsers().contains(user2));
-
- assertNotNull(policy.getGroups());
- assertEquals(2, policy.getGroups().size());
- assertTrue(policy.getGroups().contains(group1));
- assertTrue(policy.getGroups().contains(group2));
-
- assertNotNull(policy.getAction());
- assertEquals(RequestAction.READ, policy.getAction());
-
- final AccessPolicy policy2 = new AccessPolicy.Builder(policy).build();
- assertEquals(policy.getIdentifier(), policy2.getIdentifier());
- assertEquals(policy.getResource(), policy2.getResource());
- assertEquals(policy.getUsers(), policy2.getUsers());
- assertEquals(policy.getAction(), policy2.getAction());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testFromPolicyAndChangeIdentifier() {
- final AccessPolicy policy = new AccessPolicy.Builder()
- .identifier("1")
- .resource(TEST_RESOURCE)
- .addUser("user1")
- .action(RequestAction.READ)
- .build();
-
- new AccessPolicy.Builder(policy).identifier("2").build();
- }
-
- @Test
- public void testAddRemoveClearUsers() {
- final AccessPolicy.Builder builder = new AccessPolicy.Builder()
- .identifier("1")
- .resource(TEST_RESOURCE)
- .addUser("user1")
- .action(RequestAction.READ);
-
- final AccessPolicy policy1 = builder.build();
- assertEquals(1, policy1.getUsers().size());
- assertTrue(policy1.getUsers().contains("user1"));
-
- final Set<String> moreEntities = new HashSet<>();
- moreEntities.add("user2");
- moreEntities.add("user3");
- moreEntities.add("user4");
-
- final AccessPolicy policy2 = builder.addUsers(moreEntities).build();
- assertEquals(4, policy2.getUsers().size());
- assertTrue(policy2.getUsers().contains("user1"));
- assertTrue(policy2.getUsers().contains("user2"));
- assertTrue(policy2.getUsers().contains("user3"));
- assertTrue(policy2.getUsers().contains("user4"));
-
- final AccessPolicy policy3 = builder.removeUser("user3").build();
- assertEquals(3, policy3.getUsers().size());
- assertTrue(policy3.getUsers().contains("user1"));
- assertTrue(policy3.getUsers().contains("user2"));
- assertTrue(policy3.getUsers().contains("user4"));
-
- final Set<String> removeEntities = new HashSet<>();
- removeEntities.add("user1");
- removeEntities.add("user4");
-
- final AccessPolicy policy4 = builder.removeUsers(removeEntities).build();
- assertEquals(1, policy4.getUsers().size());
- assertTrue(policy4.getUsers().contains("user2"));
-
-
- final AccessPolicy policy5 = builder.clearUsers().build();
- assertEquals(0, policy5.getUsers().size());
- }
-
- @Test
- public void testAddRemoveClearGroups() {
- final AccessPolicy.Builder builder = new AccessPolicy.Builder()
- .identifier("1")
- .resource(TEST_RESOURCE)
- .addGroup("group1")
- .action(RequestAction.READ);
-
- final AccessPolicy policy1 = builder.build();
- assertEquals(1, policy1.getGroups().size());
- assertTrue(policy1.getGroups().contains("group1"));
-
- final Set<String> moreGroups = new HashSet<>();
- moreGroups.add("group2");
- moreGroups.add("group3");
- moreGroups.add("group4");
-
- final AccessPolicy policy2 = builder.addGroups(moreGroups).build();
- assertEquals(4, policy2.getGroups().size());
- assertTrue(policy2.getGroups().contains("group1"));
- assertTrue(policy2.getGroups().contains("group2"));
- assertTrue(policy2.getGroups().contains("group3"));
- assertTrue(policy2.getGroups().contains("group4"));
-
- final AccessPolicy policy3 = builder.removeGroup("group3").build();
- assertEquals(3, policy3.getGroups().size());
- assertTrue(policy3.getGroups().contains("group1"));
- assertTrue(policy3.getGroups().contains("group2"));
- assertTrue(policy3.getGroups().contains("group4"));
-
- final Set<String> removeGroups = new HashSet<>();
- removeGroups.add("group1");
- removeGroups.add("group4");
-
- final AccessPolicy policy4 = builder.removeGroups(removeGroups).build();
- assertEquals(1, policy4.getGroups().size());
- assertTrue(policy4.getGroups().contains("group2"));
-
- final AccessPolicy policy5 = builder.clearGroups().build();
- assertEquals(0, policy5.getUsers().size());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/test/java/org/apache/nifi/authorization/TestGroup.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/test/java/org/apache/nifi/authorization/TestGroup.java b/nifi-api/src/test/java/org/apache/nifi/authorization/TestGroup.java
deleted file mode 100644
index 8ccdba5..0000000
--- a/nifi-api/src/test/java/org/apache/nifi/authorization/TestGroup.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.authorization;
-
-import org.junit.Test;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public class TestGroup {
-
- @Test
- public void testSimpleCreation() {
- final String id = "1";
- final String name = "group1";
- final String user1 = "user1";
- final String user2 = "user2";
-
- final Group group = new Group.Builder()
- .identifier(id)
- .name(name)
- .addUser(user1)
- .addUser(user2)
- .build();
-
- assertEquals(id, group.getIdentifier());
- assertEquals(name, group.getName());
-
- assertNotNull(group.getUsers());
- assertEquals(2, group.getUsers().size());
- assertTrue(group.getUsers().contains(user1));
- assertTrue(group.getUsers().contains(user2));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testMissingId() {
- new Group.Builder()
- .name("group1")
- .addUser("user1")
- .addUser("user2")
- .build();
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testMissingName() {
- new Group.Builder()
- .identifier("1")
- .addUser("user1")
- .addUser("user2")
- .build();
- }
-
- @Test
- public void testMissingUsers() {
- final String id = "1";
- final String name = "group1";
-
- final Group group = new Group.Builder()
- .identifier(id)
- .name(name)
- .build();
-
- assertEquals(id, group.getIdentifier());
- assertEquals(name, group.getName());
-
- assertNotNull(group.getUsers());
- assertEquals(0, group.getUsers().size());
- }
-
- @Test
- public void testFromGroup() {
- final String id = "1";
- final String name = "group1";
- final String user1 = "user1";
- final String user2 = "user2";
-
- final Group group1 = new Group.Builder()
- .identifier(id)
- .name(name)
- .addUser(user1)
- .addUser(user2)
- .build();
-
- assertEquals(id, group1.getIdentifier());
- assertEquals(name, group1.getName());
-
- assertNotNull(group1.getUsers());
- assertEquals(2, group1.getUsers().size());
- assertTrue(group1.getUsers().contains(user1));
- assertTrue(group1.getUsers().contains(user2));
-
- final Group group2 = new Group.Builder(group1).build();
- assertEquals(group1.getIdentifier(), group2.getIdentifier());
- assertEquals(group1.getName(), group2.getName());
- assertEquals(group1.getUsers(), group2.getUsers());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testFromGroupAndChangeIdentifier() {
- final Group group1 = new Group.Builder()
- .identifier("1")
- .name("group1")
- .addUser("user1")
- .build();
-
- new Group.Builder(group1).identifier("2").build();
- }
-
- @Test
- public void testAddRemoveClearUsers() {
- final Group.Builder builder = new Group.Builder()
- .identifier("1")
- .name("group1")
- .addUser("user1");
-
- final Group group1 = builder.build();
- assertNotNull(group1.getUsers());
- assertEquals(1, group1.getUsers().size());
- assertTrue(group1.getUsers().contains("user1"));
-
- final Set<String> moreUsers = new HashSet<>();
- moreUsers.add("user2");
- moreUsers.add("user3");
- moreUsers.add("user4");
-
- final Group group2 = builder.addUsers(moreUsers).build();
- assertEquals(4, group2.getUsers().size());
- assertTrue(group2.getUsers().contains("user1"));
- assertTrue(group2.getUsers().contains("user2"));
- assertTrue(group2.getUsers().contains("user3"));
- assertTrue(group2.getUsers().contains("user4"));
-
- final Group group3 = builder.removeUser("user2").build();
- assertEquals(3, group3.getUsers().size());
- assertTrue(group3.getUsers().contains("user1"));
- assertTrue(group3.getUsers().contains("user3"));
- assertTrue(group3.getUsers().contains("user4"));
-
- final Set<String> removeUsers = new HashSet<>();
- removeUsers.add("user1");
- removeUsers.add("user4");
-
- final Group group4 = builder.removeUsers(removeUsers).build();
- assertEquals(1, group4.getUsers().size());
- assertTrue(group4.getUsers().contains("user3"));
-
- final Group group5 = builder.clearUsers().build();
- assertEquals(0, group5.getUsers().size());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/test/java/org/apache/nifi/authorization/TestUser.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/test/java/org/apache/nifi/authorization/TestUser.java b/nifi-api/src/test/java/org/apache/nifi/authorization/TestUser.java
deleted file mode 100644
index 04b1ab1..0000000
--- a/nifi-api/src/test/java/org/apache/nifi/authorization/TestUser.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.authorization;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class TestUser {
-
- @Test
- public void testSimpleCreation() {
- final String identifier = "1";
- final String identity = "user1";
- final String group1 = "group1";
- final String group2 = "group2";
-
- final User user = new User.Builder()
- .identifier(identifier)
- .identity(identity)
- .build();
-
- assertEquals(identifier, user.getIdentifier());
- assertEquals(identity, user.getIdentity());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testMissingIdentifier() {
- new User.Builder()
- .identity("user1")
- .build();
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testMissingIdentity() {
- new User.Builder()
- .identifier("1")
- .build();
- }
-
- @Test
- public void testFromUser() {
- final String identifier = "1";
- final String identity = "user1";
- final String group1 = "group1";
- final String group2 = "group2";
-
- final User user = new User.Builder()
- .identifier(identifier)
- .identity(identity)
- .build();
-
- assertEquals(identifier, user.getIdentifier());
- assertEquals(identity, user.getIdentity());
-
- final User user2 = new User.Builder(user).build();
- assertEquals(user.getIdentifier(), user2.getIdentifier());
- assertEquals(user.getIdentity(), user2.getIdentity());
- }
-
- @Test(expected = IllegalStateException.class)
- public void testFromUserAndChangeIdentifier() {
- final User user = new User.Builder()
- .identifier("1")
- .identity("user1")
- .build();
-
- new User.Builder(user).identifier("2").build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-api/src/test/java/org/apache/nifi/web/TestRevision.java
----------------------------------------------------------------------
diff --git a/nifi-api/src/test/java/org/apache/nifi/web/TestRevision.java b/nifi-api/src/test/java/org/apache/nifi/web/TestRevision.java
deleted file mode 100644
index 6d513fd..0000000
--- a/nifi-api/src/test/java/org/apache/nifi/web/TestRevision.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.web;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- *
- */
-public class TestRevision {
-
- @Test(expected = IllegalArgumentException.class)
- public void testNullVersion() throws Exception {
- new Revision(null, "client-id", "component-id");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testNullComponentId() throws Exception {
- new Revision(0l, "client-id", null);
- }
-
- @Test
- public void testIncrementRevision() throws Exception {
- final String clientId = "client-id";
- final String componentId = "component-id";
- final Revision revision = new Revision(0l, clientId, componentId);
- final Revision updatedRevision = revision.incrementRevision(clientId);
- assertEquals(1, updatedRevision.getVersion().longValue());
- assertEquals(clientId, updatedRevision.getClientId());
- assertEquals(componentId, updatedRevision.getComponentId());
- }
-
- @Test
- public void testIncrementRevisionNewClient() throws Exception {
- final String clientId = "client-id";
- final String newClientId = "new-client-id";
- final String componentId = "component-id";
- final Revision revision = new Revision(0l, clientId, componentId);
- final Revision updatedRevision = revision.incrementRevision(newClientId);
- assertEquals(1, updatedRevision.getVersion().longValue());
- assertEquals(newClientId, updatedRevision.getClientId());
- assertEquals(componentId, updatedRevision.getComponentId());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml
index 146df7d..e2b8595 100644
--- a/nifi-assembly/pom.xml
+++ b/nifi-assembly/pom.xml
@@ -82,6 +82,10 @@ language governing permissions and limitations under the License. -->
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-framework-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
<artifactId>nifi-runtime</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-commons/nifi-data-provenance-utils/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-data-provenance-utils/pom.xml b/nifi-commons/nifi-data-provenance-utils/pom.xml
index e379541..b1413c5 100644
--- a/nifi-commons/nifi-data-provenance-utils/pom.xml
+++ b/nifi-commons/nifi-data-provenance-utils/pom.xml
@@ -28,6 +28,10 @@
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-framework-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
<artifactId>nifi-utils</artifactId>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-commons/nifi-site-to-site-client/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-commons/nifi-site-to-site-client/pom.xml b/nifi-commons/nifi-site-to-site-client/pom.xml
index 4bd0913..63e5c12 100644
--- a/nifi-commons/nifi-site-to-site-client/pom.xml
+++ b/nifi-commons/nifi-site-to-site-client/pom.xml
@@ -31,6 +31,10 @@
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-framework-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
<artifactId>nifi-utils</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/pom.xml
----------------------------------------------------------------------
diff --git a/nifi-framework-api/pom.xml b/nifi-framework-api/pom.xml
new file mode 100644
index 0000000..5ece11b
--- /dev/null
+++ b/nifi-framework-api/pom.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>nifi-framework-api</artifactId>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-api</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/action/component/details/ExtensionDetails.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/action/component/details/ExtensionDetails.java b/nifi-framework-api/src/main/java/org/apache/nifi/action/component/details/ExtensionDetails.java
new file mode 100644
index 0000000..5726c1b
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/action/component/details/ExtensionDetails.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.action.component.details;
+
+/**
+ * Provides details of an extension on an Action.
+ */
+public interface ExtensionDetails extends ComponentDetails {
+
+ String getType();
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/action/component/details/RemoteProcessGroupDetails.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/action/component/details/RemoteProcessGroupDetails.java b/nifi-framework-api/src/main/java/org/apache/nifi/action/component/details/RemoteProcessGroupDetails.java
new file mode 100644
index 0000000..62f8628
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/action/component/details/RemoteProcessGroupDetails.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.action.component.details;
+
+/**
+ * Provides details of a remote process group to an Action.
+ */
+public interface RemoteProcessGroupDetails extends ComponentDetails {
+
+ String getUri();
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/action/details/ConfigureDetails.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/action/details/ConfigureDetails.java b/nifi-framework-api/src/main/java/org/apache/nifi/action/details/ConfigureDetails.java
new file mode 100644
index 0000000..ff8db40
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/action/details/ConfigureDetails.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.action.details;
+
+/**
+ * Provides details about a configure action.
+ */
+public interface ConfigureDetails extends ActionDetails {
+
+ String getName();
+
+ String getPreviousValue();
+
+ String getValue();
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/action/details/ConnectDetails.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/action/details/ConnectDetails.java b/nifi-framework-api/src/main/java/org/apache/nifi/action/details/ConnectDetails.java
new file mode 100644
index 0000000..3c8c91b
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/action/details/ConnectDetails.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.action.details;
+
+import org.apache.nifi.action.Component;
+
+/**
+ * Provides details about a connect action.
+ */
+public interface ConnectDetails extends ActionDetails {
+
+ String getSourceId();
+
+ String getSourceName();
+
+ Component getSourceType();
+
+ String getDestinationId();
+
+ String getDestinationName();
+
+ Component getDestinationType();
+
+ String getRelationship();
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/action/details/MoveDetails.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/action/details/MoveDetails.java b/nifi-framework-api/src/main/java/org/apache/nifi/action/details/MoveDetails.java
new file mode 100644
index 0000000..0533b3b
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/action/details/MoveDetails.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.action.details;
+
+/**
+ * Provides details about a move action.
+ */
+public interface MoveDetails extends ActionDetails {
+ String getGroup();
+
+ String getGroupId();
+
+ String getPreviousGroup();
+
+ String getPreviousGroupId();
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/action/details/PurgeDetails.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/action/details/PurgeDetails.java b/nifi-framework-api/src/main/java/org/apache/nifi/action/details/PurgeDetails.java
new file mode 100644
index 0000000..57bc57e
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/action/details/PurgeDetails.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.action.details;
+
+import java.util.Date;
+
+/**
+ * Provides details about a purge action.
+ */
+public interface PurgeDetails extends ActionDetails {
+
+ Date getEndDate();
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/AuthenticationResponse.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/AuthenticationResponse.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/AuthenticationResponse.java
new file mode 100644
index 0000000..e9999fc
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/AuthenticationResponse.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication;
+
+/**
+ * Authentication response for a user login attempt.
+ */
+public class AuthenticationResponse {
+
+ private final String identity;
+ private final String username;
+ private final long expiration;
+ private final String issuer;
+
+ /**
+ * Creates an authentication response. The username and how long the authentication is valid in milliseconds
+ *
+ * @param identity The user identity
+ * @param username The username
+ * @param expiration The expiration in milliseconds
+ * @param issuer The issuer of the token
+ */
+ public AuthenticationResponse(final String identity, final String username, final long expiration, final String issuer) {
+ this.identity = identity;
+ this.username = username;
+ this.expiration = expiration;
+ this.issuer = issuer;
+ }
+
+ public String getIdentity() {
+ return identity;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getIssuer() {
+ return issuer;
+ }
+
+ /**
+ * Returns the expiration of a given authentication in milliseconds.
+ *
+ * @return The expiration in milliseconds
+ */
+ public long getExpiration() {
+ return expiration;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginCredentials.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginCredentials.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginCredentials.java
new file mode 100644
index 0000000..afb7827
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginCredentials.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication;
+
+/**
+ * Login credentials for a user.
+ */
+public class LoginCredentials {
+
+ private final String username;
+ private final String password;
+
+ public LoginCredentials(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProvider.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProvider.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProvider.java
new file mode 100644
index 0000000..145bdb4
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProvider.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication;
+
+import org.apache.nifi.authentication.exception.IdentityAccessException;
+import org.apache.nifi.authentication.exception.InvalidLoginCredentialsException;
+import org.apache.nifi.authentication.exception.ProviderCreationException;
+import org.apache.nifi.authentication.exception.ProviderDestructionException;
+
+/**
+ * Identity provider that is able to authentication a user with username/password credentials.
+ */
+public interface LoginIdentityProvider {
+
+ /**
+ * Authenticates the specified login credentials.
+ *
+ * @param credentials the credentials
+ * @return The authentication response
+ * @throws InvalidLoginCredentialsException The login credentials were invalid
+ * @throws IdentityAccessException Unable to register the user due to an issue accessing the underlying storage
+ */
+ AuthenticationResponse authenticate(LoginCredentials credentials) throws InvalidLoginCredentialsException, IdentityAccessException;
+
+ /**
+ * Called immediately after instance creation for implementers to perform additional setup
+ *
+ * @param initializationContext in which to initialize
+ * @throws ProviderCreationException Unable to initialize
+ */
+ void initialize(LoginIdentityProviderInitializationContext initializationContext) throws ProviderCreationException;
+
+ /**
+ * Called to configure the AuthorityProvider.
+ *
+ * @param configurationContext at the time of configuration
+ * @throws ProviderCreationException for any issues configuring the provider
+ */
+ void onConfigured(LoginIdentityProviderConfigurationContext configurationContext) throws ProviderCreationException;
+
+ /**
+ * Called immediately before instance destruction for implementers to release resources.
+ *
+ * @throws ProviderDestructionException If pre-destruction fails.
+ */
+ void preDestruction() throws ProviderDestructionException;
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderConfigurationContext.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderConfigurationContext.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderConfigurationContext.java
new file mode 100644
index 0000000..6fe61fc
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderConfigurationContext.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication;
+
+import java.util.Map;
+
+/**
+ *
+ */
+public interface LoginIdentityProviderConfigurationContext {
+
+ /**
+ * @return identifier for the authority provider
+ */
+ String getIdentifier();
+
+ /**
+ * Retrieves all properties the component currently understands regardless
+ * of whether a value has been set for them or not. If no value is present
+ * then its value is null and thus any registered default for the property
+ * descriptor applies.
+ *
+ * @return Map of all properties
+ */
+ Map<String, String> getProperties();
+
+ /**
+ * @param property to lookup the descriptor and value of
+ * @return the value the component currently understands for the given
+ * PropertyDescriptor. This method does not substitute default
+ * PropertyDescriptor values, so the value returned will be null if not set
+ */
+ String getProperty(String property);
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderInitializationContext.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderInitializationContext.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderInitializationContext.java
new file mode 100644
index 0000000..7aa72a7
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderInitializationContext.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication;
+
+/**
+ *
+ */
+public interface LoginIdentityProviderInitializationContext {
+
+ public String getIdentifier();
+
+ public LoginIdentityProviderLookup getAuthorityProviderLookup();
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderLookup.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderLookup.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderLookup.java
new file mode 100644
index 0000000..3cd0ba7
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/LoginIdentityProviderLookup.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication;
+
+/**
+ *
+ */
+public interface LoginIdentityProviderLookup {
+
+ LoginIdentityProvider getLoginIdentityProvider(String identifier);
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/annotation/LoginIdentityProviderContext.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/annotation/LoginIdentityProviderContext.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/annotation/LoginIdentityProviderContext.java
new file mode 100644
index 0000000..88df259
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/annotation/LoginIdentityProviderContext.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ *
+ */
+@Documented
+@Target({ElementType.FIELD, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+public @interface LoginIdentityProviderContext {
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/IdentityAccessException.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/IdentityAccessException.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/IdentityAccessException.java
new file mode 100644
index 0000000..b68c675
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/IdentityAccessException.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication.exception;
+
+/**
+ * Represents the case when the identity could not be confirmed because it was unable
+ * to access the backing store.
+ */
+public class IdentityAccessException extends RuntimeException {
+
+ public IdentityAccessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public IdentityAccessException(String message) {
+ super(message);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/InvalidLoginCredentialsException.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/InvalidLoginCredentialsException.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/InvalidLoginCredentialsException.java
new file mode 100644
index 0000000..fbfa324
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/InvalidLoginCredentialsException.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication.exception;
+
+/**
+ * Represents the case when the identity could not be confirmed because the
+ * login credentials were invalid.
+ */
+public class InvalidLoginCredentialsException extends RuntimeException {
+
+ public InvalidLoginCredentialsException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidLoginCredentialsException(String message) {
+ super(message);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/nifi/blob/d1129706/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/ProviderCreationException.java
----------------------------------------------------------------------
diff --git a/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/ProviderCreationException.java b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/ProviderCreationException.java
new file mode 100644
index 0000000..b352787
--- /dev/null
+++ b/nifi-framework-api/src/main/java/org/apache/nifi/authentication/exception/ProviderCreationException.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.authentication.exception;
+
+/**
+ * Represents the exceptional case when an AuthorityProvider fails instantiated.
+ *
+ */
+public class ProviderCreationException extends RuntimeException {
+
+ public ProviderCreationException() {
+ }
+
+ public ProviderCreationException(String msg) {
+ super(msg);
+ }
+
+ public ProviderCreationException(Throwable cause) {
+ super(cause);
+ }
+
+ public ProviderCreationException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+}