[java-idp-plugin-totp] branch main updated: Implement IdPModule hook and relocate config/views.

Scott Cantor cantor.2 at osu.edu
Tue Sep 29 18:04:02 UTC 2020


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-idp-plugin-totp.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-totp.git;a=commit;h=709bef82e61f0f6e9e8bae891690b3a954753d3a

The following commit(s) were added to refs/heads/main by this push:
       new  709bef8   Implement IdPModule hook and relocate config/views.
709bef8 is described below

commit 709bef82e61f0f6e9e8bae891690b3a954753d3a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Sep 29 14:04:00 2020 -0400

    Implement IdPModule hook and relocate config/views.
---
 .../src/main/resources/conf/totp-authn-config.xml  | 41 ----------------------
 .../idp/plugin/totp/TOTPDescription.java           |  2 +-
 .../net/shibboleth/idp/plugin/totp/TOTPModule.java | 41 ++++++++++++++++++++++
 .../shibboleth/idp/flows/authn/TOTP/TOTP-beans.xml |  6 ++--
 .../services/net.shibboleth.idp.module.IdPModule   |  1 +
 .../shibboleth/idp/plugin/totp}/bin/totpauth.bat   |  0
 .../shibboleth/idp/plugin/totp}/bin/totpauth.sh    |  0
 .../idp/plugin/totp}/doc/GoogleAuth-LICENSE.txt    |  0
 .../shibboleth/idp/plugin/totp/module.properties   | 21 +++++++++++
 .../idp/plugin/totp}/views/totp-error.vm           |  0
 .../net/shibboleth/idp/plugin/totp}/views/totp.vm  |  0
 11 files changed, 67 insertions(+), 45 deletions(-)

diff --git a/totp-dist/src/main/resources/conf/totp-authn-config.xml b/totp-dist/src/main/resources/conf/totp-authn-config.xml
deleted file mode 100644
index 21a2307..0000000
--- a/totp-dist/src/main/resources/conf/totp-authn-config.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xmlns:util="http://www.springframework.org/schema/util"
-       xmlns:p="http://www.springframework.org/schema/p"
-       xmlns:c="http://www.springframework.org/schema/c"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
-                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
-                           
-       default-init-method="initialize"
-       default-destroy-method="destroy">
-
-    <!-- Override default header/field extraction. -->
-    <!--
-    <bean id="shibboleth.authn.TOTP.HeaderName" class="java.lang.String" c:_0="X-Shibboleth-TOTP" />
-    <bean id="shibboleth.authn.TOTP.FieldName" class="java.lang.String" c:_0="tokencode" />
-    -->
-    
-    <!-- Override default attribute to resolve to locate token seeds for users. -->
-    <!--
-    <bean id="shibboleth.authn.TOTP.TokenSeedAttribute" class="java.lang.String" c:_0="tokenSeeds" />
-    -->
-
-    <!-- Example static seed mappings for testing or simple use cases. -->
-    <!--
-    <bean id="shibboleth.authn.TOTP.SeedSource" parent="shibboleth.authn.TOTP.StaticSeedSource">
-        <property name="seeds">
-            <map>
-                <entry key="jdoe">
-                    <list>
-                        <value>K44GQWBAI54IQELEGYPDZG5LAJ6EJX73</value>
-                    </list>
-                </entry>
-            </map>
-        </property>
-    </bean>
-    -->
-     
-</beans>
diff --git a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPDescription.java b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPDescription.java
index a109737..4a97531 100644
--- a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPDescription.java
+++ b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPDescription.java
@@ -38,7 +38,7 @@ public class TOTPDescription extends AbstractPluginDescription {
     /** {@inheritDoc} */
     @Override
     @Nonnull @NotEmpty public String getPluginId() {
-        return "net.shibboleth.idp.plugin.totp";
+        return getClass().getPackageName();
     }
 
     /** {@inheritDoc} */
diff --git a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPModule.java b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPModule.java
new file mode 100644
index 0000000..671f81d
--- /dev/null
+++ b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPModule.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements.  See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID 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 net.shibboleth.idp.plugin.totp;
+
+import java.io.IOException;
+
+import net.shibboleth.idp.module.IdPModule;
+import net.shibboleth.idp.module.ModuleException;
+import net.shibboleth.idp.module.PropertyDrivenIdPModule;
+
+/**
+ * {@link IdPModule} implementation.
+ */
+public final class TOTPModule extends PropertyDrivenIdPModule {
+
+    /**
+     * Constructor.
+     *  
+     * @throws ModuleException on error
+     * @throws IOException on error
+     */
+    public TOTPModule() throws IOException, ModuleException {
+        super(TOTPModule.class);
+    }
+
+}
\ No newline at end of file
diff --git a/totp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/TOTP/TOTP-beans.xml b/totp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/TOTP/TOTP-beans.xml
index 342463d..309bce4 100644
--- a/totp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/TOTP/TOTP-beans.xml
+++ b/totp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/TOTP/TOTP-beans.xml
@@ -30,12 +30,12 @@
     <bean id="ExtractTOTPFromHeader"
         class="net.shibboleth.idp.plugin.totp.impl.ExtractTOTPFromHeader" scope="prototype"
         p:httpServletRequest-ref="shibboleth.HttpServletRequest"
-        p:headerName="#{getObject('shibboleth.authn.TOTP.HeaderName') ?: T(net.shibboleth.idp.plugin.totp.impl.ExtractTOTPFromHeader).DEFAULT_HEADER_NAME}" />
+        p:headerName="#{'%{idp.authn.TOTP.headerName:X-Shibboleth-TOTP}'.trim()}" />
 
     <bean id="ExtractTOTPFromFormRequest"
         class="net.shibboleth.idp.plugin.totp.impl.ExtractTOTPFromFormRequest" scope="prototype"
         p:httpServletRequest-ref="shibboleth.HttpServletRequest"
-        p:fieldName="#{getObject('shibboleth.authn.TOTP.FieldName') ?: T(net.shibboleth.idp.plugin.totp.impl.ExtractTOTPFromFormRequest).DEFAULT_FIELD_NAME}" />
+        p:fieldName="#{'%{idp.authn.TOTP.fieldName:tokencode}'.trim()}" />
             
     <bean id="ValidateTOTPCredentials"
         class="net.shibboleth.idp.authn.impl.ValidateCredentials" scope="prototype"
@@ -60,7 +60,7 @@
         
     <bean id="DefaultSeedSource" class="net.shibboleth.idp.plugin.totp.impl.AttributeResolverSeedSource" lazy-init="true"
         p:attributeResolver-ref="shibboleth.AttributeResolverService"
-        p:sourceAttribute="#{getObject('shibboleth.authn.TOTP.TokenSeedAttribute') ?: T(net.shibboleth.idp.plugin.totp.impl.AttributeResolverSeedSource).DEFAULT_ATTRIBUTE_ID}" />
+        p:sourceAttribute="#{'%{idp.authn.TOTP.tokenSeedAttribute:tokenSeeds}'.trim()}" />
 
     <!-- Parent bean for use of alternative seed source. -->
     <bean id="shibboleth.authn.TOTP.StaticSeedSource" class="net.shibboleth.idp.plugin.totp.impl.StaticSeedSource" abstract="true" />
diff --git a/totp-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule b/totp-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
new file mode 100644
index 0000000..2ac01fd
--- /dev/null
+++ b/totp-impl/src/main/resources/META-INF/services/net.shibboleth.idp.module.IdPModule
@@ -0,0 +1 @@
+net.shibboleth.idp.plugin.totp.TOTPModule
diff --git a/totp-dist/src/main/resources/bin/totpauth.bat b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/bin/totpauth.bat
similarity index 100%
rename from totp-dist/src/main/resources/bin/totpauth.bat
rename to totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/bin/totpauth.bat
diff --git a/totp-dist/src/main/resources/bin/totpauth.sh b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/bin/totpauth.sh
similarity index 100%
rename from totp-dist/src/main/resources/bin/totpauth.sh
rename to totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/bin/totpauth.sh
diff --git a/totp-dist/src/main/resources/doc/GoogleAuth-LICENSE.txt b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/doc/GoogleAuth-LICENSE.txt
similarity index 100%
rename from totp-dist/src/main/resources/doc/GoogleAuth-LICENSE.txt
rename to totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/doc/GoogleAuth-LICENSE.txt
diff --git a/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/module.properties b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/module.properties
new file mode 100644
index 0000000..d67bdac
--- /dev/null
+++ b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/module.properties
@@ -0,0 +1,21 @@
+# Properties defining this module.
+
+# Class to Module ID mappings
+net.shibboleth.idp.plugin.totp.TOTPModule = idp.authn.TOTP
+
+idp.authn.TOTP.name = TOTP Authentication
+idp.authn.TOTP.desc = Login flow for TOTP tokens
+idp.authn.TOTP.url = https://wiki.shibboleth.net/confluence/display/IDPPLUG/TOTPConfiguration
+idp.authn.TOTP.1.src = /net/shibboleth/idp/plugin/totp/bin/totpauth.bat
+idp.authn.TOTP.1.dest = bin/totpauth.bat
+idp.authn.TOTP.1.replace = true
+idp.authn.TOTP.2.src = /net/shibboleth/idp/plugin/totp/bin/totpauth.sh
+idp.authn.TOTP.2.dest = bin/totpauth.sh
+idp.authn.TOTP.2.replace = true
+idp.authn.TOTP.3.src = /net/shibboleth/idp/plugin/totp/views/totp.vm
+idp.authn.TOTP.3.dest = views/totp.vm
+idp.authn.TOTP.4.src = /net/shibboleth/idp/plugin/totp/views/totp-error.vm
+idp.authn.TOTP.4.dest = views/totp-error.vm
+idp.authn.TOTP.5.src = /net/shibboleth/idp/plugin/totp/doc/GoogleAuth-LICENSE.txt
+idp.authn.TOTP.5.dest = doc/GoogleAuth-LICENSE.txt
+idp.authn.TOTP.5.replace = true
diff --git a/totp-dist/src/main/resources/views/totp-error.vm b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/views/totp-error.vm
similarity index 100%
rename from totp-dist/src/main/resources/views/totp-error.vm
rename to totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/views/totp-error.vm
diff --git a/totp-dist/src/main/resources/views/totp.vm b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/views/totp.vm
similarity index 100%
rename from totp-dist/src/main/resources/views/totp.vm
rename to totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/views/totp.vm

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list