[java-idp-plugin-totp] branch main updated: Rebase plugin approach on new classes.

Scott Cantor cantor.2 at osu.edu
Fri Oct 2 17:14:07 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=31eacfec55a45df294883cab1325c8e33ac2c43e

The following commit(s) were added to refs/heads/main by this push:
       new  31eacfe   Rebase plugin approach on new classes.
31eacfe is described below

commit 31eacfec55a45df294883cab1325c8e33ac2c43e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Oct 2 13:14:04 2020 -0400

    Rebase plugin approach on new classes.
---
 .../src/main/assembly/plugin-assembly-tgz.xml      |  7 +++
 .../src/main/assembly/plugin-assembly-zip.xml      |  8 +++
 totp-dist/src/main/resources/bootstrap/id.property |  1 -
 .../net/shibboleth/idp/plugin/totp/TOTPPlugin.java | 64 ++++++++--------------
 .../shibboleth/idp/plugin/totp/plugin.properties   |  8 +++
 5 files changed, 47 insertions(+), 41 deletions(-)

diff --git a/totp-dist/src/main/assembly/plugin-assembly-tgz.xml b/totp-dist/src/main/assembly/plugin-assembly-tgz.xml
index 54b4335..7de2b87 100644
--- a/totp-dist/src/main/assembly/plugin-assembly-tgz.xml
+++ b/totp-dist/src/main/assembly/plugin-assembly-tgz.xml
@@ -28,6 +28,13 @@
                 <exclude>*sources.jar</exclude>
             </excludes>
         </fileSet>
+        <fileSet>
+            <directory>../totp-impl/target/classes/net/shibboleth/idp/plugin/totp</directory>
+            <outputDirectory>bootstrap</outputDirectory>
+            <includes>
+                <include>plugin.properties</include>
+            </includes>
+        </fileSet>
         <fileSet>
             <directory>${dist.assemblyDirectory}</directory>
             <outputDirectory></outputDirectory>
diff --git a/totp-dist/src/main/assembly/plugin-assembly-zip.xml b/totp-dist/src/main/assembly/plugin-assembly-zip.xml
index f5a1645..17cc0d5 100644
--- a/totp-dist/src/main/assembly/plugin-assembly-zip.xml
+++ b/totp-dist/src/main/assembly/plugin-assembly-zip.xml
@@ -28,6 +28,14 @@
                 <exclude>*sources.jar</exclude>
             </excludes>
         </fileSet>
+        <fileSet>
+            <directory>../totp-impl/target/classes/net/shibboleth/idp/plugin/totp</directory>
+            <outputDirectory>bootstrap</outputDirectory>
+            <includes>
+                <include>plugin.properties</include>
+            </includes>
+            <lineEnding>windows</lineEnding>
+        </fileSet>
         <fileSet>
             <directory>${dist.assemblyDirectory}</directory>
             <outputDirectory></outputDirectory>
diff --git a/totp-dist/src/main/resources/bootstrap/id.property b/totp-dist/src/main/resources/bootstrap/id.property
deleted file mode 100644
index 4917477..0000000
--- a/totp-dist/src/main/resources/bootstrap/id.property
+++ /dev/null
@@ -1 +0,0 @@
-pluginid=net.shibboleth.idp.plugin.totp
diff --git a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPPlugin.java b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPPlugin.java
index d4c7641..a1c23f8 100644
--- a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPPlugin.java
+++ b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/TOTPPlugin.java
@@ -18,51 +18,35 @@
 package net.shibboleth.idp.plugin.totp;
 
 import java.io.IOException;
-import java.net.URL;
 import java.util.Collections;
-import java.util.List;
 
-import javax.annotation.Nonnull;
-
-import org.springframework.core.io.ClassPathResource;
-
-import net.shibboleth.idp.plugin.AbstractIdPPlugin;
-import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.idp.module.IdPModule;
+import net.shibboleth.idp.module.ModuleException;
+import net.shibboleth.idp.plugin.PluginException;
+import net.shibboleth.idp.plugin.impl.FirstPartyIdPPlugin;
 
 /**
  * Details about the TOTP login plugin.
  */
-public class TOTPPlugin extends AbstractIdPPlugin {
-
-    /** {@inheritDoc} */
-    @Override
-    @Nonnull @NotEmpty public String getPluginId() {
-        return getClass().getPackageName();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    @Nonnull @NonnullElements public List<URL> getUpdateURLs() throws IOException {
-        return Collections.singletonList(new ClassPathResource("META-INF/plugins/plugin.props").getURL());
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getMajorVersion() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getMinorVersion() {
-        return 0;
+public class TOTPPlugin extends FirstPartyIdPPlugin {
+    
+    /**
+     * Constructor.
+     * 
+     * @throws PluginException 
+     * @throws IOException
+     */
+    public TOTPPlugin() throws IOException, PluginException {
+        super(TOTPPlugin.class);
+        try {
+            final IdPModule module = new TOTPModule();
+            setEnableOnInstall(Collections.singleton(module));
+            setDisableOnRemoval(Collections.singleton(module));
+        } catch (final IOException e) {
+            throw e;
+        } catch (final ModuleException e) {
+            throw new PluginException(e);
+        }
     }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getPatchVersion() {
-        return 1;
-    }
-
+    
 }
\ No newline at end of file
diff --git a/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/plugin.properties b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/plugin.properties
new file mode 100644
index 0000000..9fc2223
--- /dev/null
+++ b/totp-impl/src/main/resources/net/shibboleth/idp/plugin/totp/plugin.properties
@@ -0,0 +1,8 @@
+# Properties defining this plugin
+
+plugin.id = net.shibboleth.idp.plugin.totp
+# Only used when package manifest is not available
+plugin.version = 1.0.0
+
+# No prereqs
+#plugin.modules.required =
\ No newline at end of file

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


More information about the commits mailing list