This is an automated email from the ASF dual-hosted git repository.

harikrishna pushed a commit to branch 2FA
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 50e3cd3e01b34cac15557e307c0813ce58b560e5
Author: Harikrishna Patnala <[email protected]>
AuthorDate: Tue Aug 9 15:26:40 2022 +0530

    Added 2FA plugin
---
 plugins/pom.xml                                    |  3 ++
 .../user-two-factor-authenticators/google/pom.xml  | 30 +++++++++++++++++++
 .../auth/GoogleUserTwoFactorAuthenticator.java     | 32 ++++++++++++++++++++
 .../cloudstack/plaintext/module.properties         | 18 +++++++++++
 .../cloudstack/plaintext/spring-google-context.xml | 35 ++++++++++++++++++++++
 .../static-pin/pom.xml                             | 30 +++++++++++++++++++
 .../auth/StaticPinUserTwoFactorAuthenticator.java  | 31 +++++++++++++++++++
 .../cloudstack/static-pin/module.properties        | 18 +++++++++++
 .../static-pin/spring-static-pin-context.xml       | 35 ++++++++++++++++++++++
 .../server/auth/UserTwoFactorAuthenticator.java    | 22 ++++++++++++++
 10 files changed, 254 insertions(+)

diff --git a/plugins/pom.xml b/plugins/pom.xml
index 8534000afc0..95ad47418d9 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -134,6 +134,9 @@
         <module>user-authenticators/plain-text</module>
         <module>user-authenticators/saml2</module>
         <module>user-authenticators/sha256salted</module>
+
+        <module>user-two-factor-authenticators/google</module>
+        <module>user-two-factor-authenticators/static-pin</module>
    </modules>
     <dependencies>
         <dependency>
diff --git a/plugins/user-two-factor-authenticators/google/pom.xml 
b/plugins/user-two-factor-authenticators/google/pom.xml
new file mode 100644
index 00000000000..f162dc2ebe4
--- /dev/null
+++ b/plugins/user-two-factor-authenticators/google/pom.xml
@@ -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.
+-->
+<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/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>cloud-plugin-user-two-factor-authenticator-google</artifactId>
+    <name>Apache CloudStack Plugin - User Two Factor Authenticator 
Google</name>
+    <parent>
+        <groupId>org.apache.cloudstack</groupId>
+        <artifactId>cloudstack-plugins</artifactId>
+        <version>4.18.0.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+</project>
\ No newline at end of file
diff --git 
a/plugins/user-two-factor-authenticators/google/src/main/java/com/cloud/server/auth/GoogleUserTwoFactorAuthenticator.java
 
b/plugins/user-two-factor-authenticators/google/src/main/java/com/cloud/server/auth/GoogleUserTwoFactorAuthenticator.java
new file mode 100644
index 00000000000..6374afb2106
--- /dev/null
+++ 
b/plugins/user-two-factor-authenticators/google/src/main/java/com/cloud/server/auth/GoogleUserTwoFactorAuthenticator.java
@@ -0,0 +1,32 @@
+// 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 com.cloud.server.auth;
+
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.user.dao.UserAccountDao;
+import com.cloud.utils.component.AdapterBase;
+
+public class GoogleUserTwoFactorAuthenticator extends AdapterBase implements 
UserTwoFactorAuthenticator {
+    public static final Logger s_logger = 
Logger.getLogger(GoogleUserTwoFactorAuthenticator.class);
+
+    @Inject
+    private UserAccountDao _userAccountDao;
+
+}
diff --git 
a/plugins/user-two-factor-authenticators/google/src/main/resources/META-INF/cloudstack/plaintext/module.properties
 
b/plugins/user-two-factor-authenticators/google/src/main/resources/META-INF/cloudstack/plaintext/module.properties
new file mode 100644
index 00000000000..b0a425bfbc8
--- /dev/null
+++ 
b/plugins/user-two-factor-authenticators/google/src/main/resources/META-INF/cloudstack/plaintext/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=google
+parent=api
\ No newline at end of file
diff --git 
a/plugins/user-two-factor-authenticators/google/src/main/resources/META-INF/cloudstack/plaintext/spring-google-context.xml
 
b/plugins/user-two-factor-authenticators/google/src/main/resources/META-INF/cloudstack/plaintext/spring-google-context.xml
new file mode 100644
index 00000000000..ac4b731dbae
--- /dev/null
+++ 
b/plugins/user-two-factor-authenticators/google/src/main/resources/META-INF/cloudstack/plaintext/spring-google-context.xml
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:context="http://www.springframework.org/schema/context";
+       xmlns:aop="http://www.springframework.org/schema/aop";
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      
http://www.springframework.org/schema/beans/spring-beans.xsd
+                      http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop.xsd
+                      http://www.springframework.org/schema/context
+                      
http://www.springframework.org/schema/context/spring-context.xsd";
+                      >
+
+    <bean id="GoogleUserTwoFactorAuthenticator" 
class="com.cloud.server.auth.GoogleUserTwoFactorAuthenticator">
+        <property name="name" value="GOOGLE" />
+    </bean>
+
+    
+</beans>
diff --git a/plugins/user-two-factor-authenticators/static-pin/pom.xml 
b/plugins/user-two-factor-authenticators/static-pin/pom.xml
new file mode 100644
index 00000000000..1bb140edb7e
--- /dev/null
+++ b/plugins/user-two-factor-authenticators/static-pin/pom.xml
@@ -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.
+-->
+<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/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    
<artifactId>cloud-plugin-user-two-factor-authenticator-static-pin</artifactId>
+    <name>Apache CloudStack Plugin - User Two Factor Authenticator Static 
Pin</name>
+    <parent>
+        <groupId>org.apache.cloudstack</groupId>
+        <artifactId>cloudstack-plugins</artifactId>
+        <version>4.18.0.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+</project>
\ No newline at end of file
diff --git 
a/plugins/user-two-factor-authenticators/static-pin/src/main/java/com/cloud/server/auth/StaticPinUserTwoFactorAuthenticator.java
 
b/plugins/user-two-factor-authenticators/static-pin/src/main/java/com/cloud/server/auth/StaticPinUserTwoFactorAuthenticator.java
new file mode 100644
index 00000000000..f5dd688a8a8
--- /dev/null
+++ 
b/plugins/user-two-factor-authenticators/static-pin/src/main/java/com/cloud/server/auth/StaticPinUserTwoFactorAuthenticator.java
@@ -0,0 +1,31 @@
+// 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 com.cloud.server.auth;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.user.dao.UserAccountDao;
+import com.cloud.utils.component.AdapterBase;
+
+public class StaticPinUserTwoFactorAuthenticator extends AdapterBase 
implements UserTwoFactorAuthenticator {
+    public static final Logger s_logger = 
Logger.getLogger(StaticPinUserTwoFactorAuthenticator.class);
+
+    @Inject
+    private UserAccountDao _userAccountDao;
+
+}
diff --git 
a/plugins/user-two-factor-authenticators/static-pin/src/main/resources/META-INF/cloudstack/static-pin/module.properties
 
b/plugins/user-two-factor-authenticators/static-pin/src/main/resources/META-INF/cloudstack/static-pin/module.properties
new file mode 100644
index 00000000000..ca0902de549
--- /dev/null
+++ 
b/plugins/user-two-factor-authenticators/static-pin/src/main/resources/META-INF/cloudstack/static-pin/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=static-pin
+parent=api
\ No newline at end of file
diff --git 
a/plugins/user-two-factor-authenticators/static-pin/src/main/resources/META-INF/cloudstack/static-pin/spring-static-pin-context.xml
 
b/plugins/user-two-factor-authenticators/static-pin/src/main/resources/META-INF/cloudstack/static-pin/spring-static-pin-context.xml
new file mode 100644
index 00000000000..0dc5cfa6d44
--- /dev/null
+++ 
b/plugins/user-two-factor-authenticators/static-pin/src/main/resources/META-INF/cloudstack/static-pin/spring-static-pin-context.xml
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:context="http://www.springframework.org/schema/context";
+       xmlns:aop="http://www.springframework.org/schema/aop";
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      
http://www.springframework.org/schema/beans/spring-beans.xsd
+                      http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop.xsd
+                      http://www.springframework.org/schema/context
+                      
http://www.springframework.org/schema/context/spring-context.xsd";
+                      >
+
+    <bean id="StaticPinUserTwoFactorAuthenticator" 
class="com.cloud.server.auth.StaticPinUserTwoFactorAuthenticator">
+        <property name="name" value="StaticPin" />
+    </bean>
+
+    
+</beans>
diff --git 
a/server/src/main/java/com/cloud/server/auth/UserTwoFactorAuthenticator.java 
b/server/src/main/java/com/cloud/server/auth/UserTwoFactorAuthenticator.java
new file mode 100644
index 00000000000..da7d56b178a
--- /dev/null
+++ b/server/src/main/java/com/cloud/server/auth/UserTwoFactorAuthenticator.java
@@ -0,0 +1,22 @@
+// 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 com.cloud.server.auth;
+
+import com.cloud.utils.component.Adapter;
+
+public interface UserTwoFactorAuthenticator  extends Adapter {
+}

Reply via email to