nifi-registry git commit: Initial commit
Repository: nifi-registry Updated Branches: refs/heads/master [created] 70d81f94a Initial commit Project: http://git-wip-us.apache.org/repos/asf/nifi-registry/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi-registry/commit/70d81f94 Tree: http://git-wip-us.apache.org/repos/asf/nifi-registry/tree/70d81f94 Diff: http://git-wip-us.apache.org/repos/asf/nifi-registry/diff/70d81f94 Branch: refs/heads/master Commit: 70d81f94ac20f1186cb6ce628e9a49460fdaf148 Parents: Author: Bryan BendeAuthored: Thu Mar 16 14:23:18 2017 -0400 Committer: Bryan Bende Committed: Thu Mar 16 14:23:18 2017 -0400 -- --
[nifi-registry] Git Push Summary
Repository: nifi-registry Updated Branches: refs/heads/NIFIREG-1 [deleted] 8c295feb1
[2/2] nifi-registry git commit: NIFIREG-1 Initial project structure for NiFi Registry
NIFIREG-1 Initial project structure for NiFi Registry Project: http://git-wip-us.apache.org/repos/asf/nifi-registry/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi-registry/commit/8c295feb Tree: http://git-wip-us.apache.org/repos/asf/nifi-registry/tree/8c295feb Diff: http://git-wip-us.apache.org/repos/asf/nifi-registry/diff/8c295feb Branch: refs/heads/NIFIREG-1 Commit: 8c295feb1b1469e565635be25305f5ea0cccdc6e Parents: Author: Bryan BendeAuthored: Thu Mar 16 13:45:16 2017 -0400 Committer: Bryan Bende Committed: Thu Mar 16 13:45:16 2017 -0400 -- .gitignore | 16 + LICENSE | 203 ++ NOTICE | 6 + README.md | 44 ++ nifi-registry-assembly/pom.xml | 127 .../src/main/assembly/dependencies.xml | 80 +++ nifi-registry-jetty/pom.xml | 77 +++ .../apache/nifi/registry/jetty/JettyServer.java | 343 ++ nifi-registry-properties/pom.xml| 31 + .../properties/NiFiRegistryProperties.java | 147 nifi-registry-resources/pom.xml | 50 ++ .../src/main/assembly/dependencies.xml | 36 + .../main/resources/bin/dump-nifi-registry.bat | 47 ++ .../src/main/resources/bin/nifi-registry.sh | 216 ++ .../main/resources/bin/run-nifi-registry.bat| 48 ++ .../main/resources/bin/status-nifi-registry.bat | 47 ++ .../main/resources/conf/authorized-users.xml| 20 + .../src/main/resources/conf/bootstrap.conf | 57 ++ .../src/main/resources/conf/logback.xml | 51 ++ .../resources/conf/nifi-registry.properties | 34 + nifi-registry-runtime/pom.xml | 37 + .../org/apache/nifi/registry/NiFiRegistry.java | 70 ++ nifi-registry-security/pom.xml | 70 ++ .../security/AuthorizationProvider.java | 88 +++ .../registry/security/AuthorizedUserFilter.java | 87 +++ nifi-registry-security/src/main/xsd/users.xsd | 37 + nifi-registry-service-api/pom.xml | 35 + nifi-registry-web-api/pom.xml | 61 ++ .../web/NiFiRegistryResourceConfig.java | 44 ++ .../nifi/registry/web/api/TestResource.java | 37 + .../mapper/IllegalArgumentExceptionMapper.java | 46 ++ .../registry/web/mapper/ThrowableMapper.java| 40 ++ .../registry/web/request/IntegerParameter.java | 39 ++ .../nifi/registry/web/response/TestEntity.java | 31 + .../src/main/webapp/WEB-INF/web.xml | 45 ++ nifi-registry-web-ui/pom.xml| 50 ++ .../src/main/webapp/WEB-INF/pages/index.jsp | 30 + .../src/main/webapp/WEB-INF/web.xml | 32 + .../src/main/webapp/css/main.css| 22 + pom.xml | 680 +++ 40 files changed, 3261 insertions(+) -- http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/8c295feb/.gitignore -- diff --git a/.gitignore b/.gitignore new file mode 100644 index 000..a2e04fa --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +target +.project +.settings +.classpath +nbactions.xml +nb-configuration.xml +.DS_Store +.metadata +.recommenders + +# Intellij +.idea/ +*.iml +*.iws +*~ + http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/8c295feb/LICENSE -- diff --git a/LICENSE b/LICENSE new file mode 100644 index 000..6b0b127 --- /dev/null +++ b/LICENSE @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 +http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this
[1/2] nifi-registry git commit: NIFIREG-1 Initial project structure for NiFi Registry
Repository: nifi-registry Updated Branches: refs/heads/NIFIREG-1 [created] 8c295feb1 http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/8c295feb/nifi-registry-security/pom.xml -- diff --git a/nifi-registry-security/pom.xml b/nifi-registry-security/pom.xml new file mode 100644 index 000..d7711e9 --- /dev/null +++ b/nifi-registry-security/pom.xml @@ -0,0 +1,70 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + +org.apache.nifi.registry +nifi-registry +0.0.1-SNAPSHOT + +nifi-registry-security +jar + + + +src/main/xsd + + + + +org.codehaus.mojo +jaxb2-maven-plugin + + +xjc + +xjc + + + org.apache.nifi.registry.user.generated + + + + + ${project.build.directory}/generated-sources/jaxb + + + +org.apache.maven.plugins +maven-checkstyle-plugin + +**/user/generated/*.java + + + + + + +org.apache.nifi.registry +nifi-registry-properties +0.0.1-SNAPSHOT + + +javax.servlet +javax.servlet-api + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi-registry/blob/8c295feb/nifi-registry-security/src/main/java/org/apache/nifi/registry/security/AuthorizationProvider.java -- diff --git a/nifi-registry-security/src/main/java/org/apache/nifi/registry/security/AuthorizationProvider.java b/nifi-registry-security/src/main/java/org/apache/nifi/registry/security/AuthorizationProvider.java new file mode 100644 index 000..89be63e --- /dev/null +++ b/nifi-registry-security/src/main/java/org/apache/nifi/registry/security/AuthorizationProvider.java @@ -0,0 +1,88 @@ +/* + * 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.registry.security; + +import org.apache.nifi.registry.properties.NiFiRegistryProperties; +import org.apache.nifi.registry.user.generated.User; +import org.apache.nifi.registry.user.generated.Users; +import org.xml.sax.SAXException; + +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class AuthorizationProvider { + +private static final String USERS_XSD = "/users.xsd"; +private static final String JAXB_GENERATED_PATH = "org.apache.nifi.registry.user.generated"; +private static final JAXBContext JAXB_CONTEXT = initializeJaxbContext(); + +/** + * Load the JAXBContext. + */ +private static JAXBContext initializeJaxbContext() { +try { +return JAXBContext.newInstance(JAXB_GENERATED_PATH, AuthorizationProvider.class.getClassLoader()); +} catch (JAXBException e) { +throw new RuntimeException("Unable to create JAXBContext."); +} +} + +private final List authorizedUsers; + +public AuthorizationProvider(final NiFiRegistryProperties properties) { +final File usersFile = properties.getAuthorizedUsersFile(); +final List userList = new ArrayList<>(); + +// load the users from the specified file +if (usersFile != null && usersFile.exists()) { +try { +