[24/50] incubator-eagle git commit: [EAGLE-582] add simple Basic Authentication registration to server appl…
[EAGLE-582] add simple Basic Authentication registration to server appl⦠This is one of the sub-tasks of ticket EAGLE-433, to successfully register a simple Basic Authentication authenticator to the server application. With this check-in, when the server is up, any access to rest api method that has a Auth annotation on it's User field will require correct credentials. Author: anyway1021Closes #468 from anyway1021/EAGLE-582. Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/649adb1a Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/649adb1a Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/649adb1a Branch: refs/heads/master Commit: 649adb1ae400e026a8e932d53bd813f03fecb2d1 Parents: 7bd5d1d Author: anyway1021 Authored: Fri Oct 14 12:13:23 2016 +0800 Committer: anyway1021 Committed: Fri Oct 14 12:13:23 2016 +0800 -- .../eagle/common/authentication/User.java | 45 ++ eagle-server/pom.xml| 23 +++ .../apache/eagle/server/ServerApplication.java | 22 +-- .../org/apache/eagle/server/ServerConfig.java | 14 ++ .../authentication/AuthenticationMode.java | 51 +++ .../AuthenticationModeIdentifier.java | 105 ++ .../authentication/AuthenticationRegister.java | 41 ++ .../SwitchableBasicAuthProvider.java| 50 +++ .../AbstractSwitchableAuthenticator.java| 48 +++ .../authenticator/LdapBasicAuthenticator.java | 40 ++ .../authenticator/SimpleBasicAuthenticator.java | 43 ++ .../config/AuthenticationSettings.java | 119 .../authentication/config/LdapSettings.java | 142 +++ .../authentication/config/SimpleSettings.java | 46 ++ .../src/main/resources/application.conf | 2 +- .../src/main/resources/configuration.yml| 48 ++- .../TestBasicAuthenticationResource.java| 39 + .../src/test/resources/configuration.yml| 45 ++ pom.xml | 13 +- 19 files changed, 924 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java -- diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java new file mode 100644 index 000..85388cd --- /dev/null +++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java @@ -0,0 +1,45 @@ +/* + * 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.eagle.common.authentication; + +import java.io.Serializable; +import java.security.Principal; +import java.util.Set; + +public class User implements Principal, Serializable { +private String username = "Unauthenticated"; +private Set roles = null; + +public User() {} + +public User(String username) { +this.username = username; +} + +public User(String username, Set roles) { +this.username = username; +this.roles = roles; +} + +public Set getRoles() { +return roles; +} + +public String getName() { +return username; +} +} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/pom.xml -- diff --git a/eagle-server/pom.xml b/eagle-server/pom.xml index 21bda30..7fe4397 100644 --- a/eagle-server/pom.xml +++ b/eagle-server/pom.xml @@ -133,6 +133,14 @@ org.wso2.orbit.com.lmax disruptor + +org.slf4j +slf4j-log4j12 + + +
incubator-eagle git commit: [EAGLE-582] add simple Basic Authentication registration to server appl…
Repository: incubator-eagle Updated Branches: refs/heads/master 7bd5d1d2a -> 649adb1ae [EAGLE-582] add simple Basic Authentication registration to server appl⦠This is one of the sub-tasks of ticket EAGLE-433, to successfully register a simple Basic Authentication authenticator to the server application. With this check-in, when the server is up, any access to rest api method that has a Auth annotation on it's User field will require correct credentials. Author: anyway1021Closes #468 from anyway1021/EAGLE-582. Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/649adb1a Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/649adb1a Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/649adb1a Branch: refs/heads/master Commit: 649adb1ae400e026a8e932d53bd813f03fecb2d1 Parents: 7bd5d1d Author: anyway1021 Authored: Fri Oct 14 12:13:23 2016 +0800 Committer: anyway1021 Committed: Fri Oct 14 12:13:23 2016 +0800 -- .../eagle/common/authentication/User.java | 45 ++ eagle-server/pom.xml| 23 +++ .../apache/eagle/server/ServerApplication.java | 22 +-- .../org/apache/eagle/server/ServerConfig.java | 14 ++ .../authentication/AuthenticationMode.java | 51 +++ .../AuthenticationModeIdentifier.java | 105 ++ .../authentication/AuthenticationRegister.java | 41 ++ .../SwitchableBasicAuthProvider.java| 50 +++ .../AbstractSwitchableAuthenticator.java| 48 +++ .../authenticator/LdapBasicAuthenticator.java | 40 ++ .../authenticator/SimpleBasicAuthenticator.java | 43 ++ .../config/AuthenticationSettings.java | 119 .../authentication/config/LdapSettings.java | 142 +++ .../authentication/config/SimpleSettings.java | 46 ++ .../src/main/resources/application.conf | 2 +- .../src/main/resources/configuration.yml| 48 ++- .../TestBasicAuthenticationResource.java| 39 + .../src/test/resources/configuration.yml| 45 ++ pom.xml | 13 +- 19 files changed, 924 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java -- diff --git a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java new file mode 100644 index 000..85388cd --- /dev/null +++ b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/authentication/User.java @@ -0,0 +1,45 @@ +/* + * 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.eagle.common.authentication; + +import java.io.Serializable; +import java.security.Principal; +import java.util.Set; + +public class User implements Principal, Serializable { +private String username = "Unauthenticated"; +private Set roles = null; + +public User() {} + +public User(String username) { +this.username = username; +} + +public User(String username, Set roles) { +this.username = username; +this.roles = roles; +} + +public Set getRoles() { +return roles; +} + +public String getName() { +return username; +} +} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/649adb1a/eagle-server/pom.xml -- diff --git a/eagle-server/pom.xml b/eagle-server/pom.xml index 21bda30..7fe4397 100644 --- a/eagle-server/pom.xml +++ b/eagle-server/pom.xml @@ -133,6 +133,14 @@ org.wso2.orbit.com.lmax disruptor + +org.slf4j +