[java-identity-provider] branch main updated: For future use.

Scott Cantor cantor.2 at osu.edu
Thu Jan 21 14:47:43 UTC 2021


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

scantor pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=24a16ff5c40ca38bae0693a7c498205ea73f4a76

The following commit(s) were added to refs/heads/main by this push:
       new  24a16ff5c For future use.
24a16ff5c is described below

commit 24a16ff5c40ca38bae0693a7c498205ea73f4a76
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jan 21 09:47:39 2021 -0500

    For future use.
---
 .../idp/authn/principal/HOTPPrincipal.java         | 92 ++++++++++++++++++++++
 1 file changed, 92 insertions(+)

diff --git a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/HOTPPrincipal.java b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/HOTPPrincipal.java
new file mode 100644
index 000000000..f9d4f2bbc
--- /dev/null
+++ b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/HOTPPrincipal.java
@@ -0,0 +1,92 @@
+/*
+ * 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.authn.principal;
+
+import javax.annotation.Nonnull;
+
+import net.shibboleth.utilities.java.support.annotation.ParameterName;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
+import com.google.common.base.MoreObjects;
+
+/**
+ * Principal based on an HOTP authentication.
+ * 
+ * @since 4.1.0
+ */
+public class HOTPPrincipal implements CloneablePrincipal {
+
+    /** The username. */
+    @Nonnull @NotEmpty private String username;
+
+    /**
+     * Constructor.
+     * 
+     * @param name the username
+     */
+    public HOTPPrincipal(@Nonnull @NotEmpty @ParameterName(name="name") final String name) {
+        username = Constraint.isNotNull(StringSupport.trimOrNull(name), "Username cannot be null or empty");
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    @Nonnull @NotEmpty public String getName() {
+        return username;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public int hashCode() {
+        return username.hashCode();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean equals(final Object other) {
+        if (other == null) {
+            return false;
+        }
+
+        if (this == other) {
+            return true;
+        }
+
+        if (other instanceof HOTPPrincipal) {
+            return username.equals(((HOTPPrincipal) other).getName());
+        }
+
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(this).add("username", username).toString();
+    }
+    
+    /** {@inheritDoc} */
+    @Override
+    public HOTPPrincipal clone() throws CloneNotSupportedException {
+        final HOTPPrincipal copy = (HOTPPrincipal) super.clone();
+        copy.username = username;
+        return copy;
+    }
+    
+}
\ 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