[java-idp-plugin-totp] branch main updated: Use built-in TOTPPrincipal.
Scott Cantor
cantor.2 at osu.edu
Thu Aug 27 18:37:12 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=31f2799e650a3c06ff9b5a4c6b1ef8d4fff7a4fd
The following commit(s) were added to refs/heads/main by this push:
new 31f2799 Use built-in TOTPPrincipal.
31f2799 is described below
commit 31f2799e650a3c06ff9b5a4c6b1ef8d4fff7a4fd
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Aug 27 14:37:04 2020 -0400
Use built-in TOTPPrincipal.
---
.../plugin/totp/impl/TOTPCredentialValidator.java | 2 +-
.../idp/plugin/totp/principal/TOTPPrincipal.java | 89 ----------------------
.../idp/plugin/totp/principal/package-info.java | 22 ------
.../totp/impl/GoogleTOTPAuthenticatorTest.java | 2 +-
4 files changed, 2 insertions(+), 113 deletions(-)
diff --git a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/impl/TOTPCredentialValidator.java b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/impl/TOTPCredentialValidator.java
index 08deaa9..dca4873 100644
--- a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/impl/TOTPCredentialValidator.java
+++ b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/impl/TOTPCredentialValidator.java
@@ -36,8 +36,8 @@ import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.CredentialValidator;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
+import net.shibboleth.idp.authn.principal.TOTPPrincipal;
import net.shibboleth.idp.plugin.totp.context.TOTPContext;
-import net.shibboleth.idp.plugin.totp.principal.TOTPPrincipal;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
diff --git a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/principal/TOTPPrincipal.java b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/principal/TOTPPrincipal.java
deleted file mode 100644
index a746f74..0000000
--- a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/principal/TOTPPrincipal.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.principal;
-
-import javax.annotation.Nonnull;
-
-import net.shibboleth.idp.authn.principal.CloneablePrincipal;
-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 a TOTP authentication. */
-public class TOTPPrincipal implements CloneablePrincipal {
-
- /** The username. */
- @Nonnull @NotEmpty private String username;
-
- /**
- * Constructor.
- *
- * @param name the username
- */
- public TOTPPrincipal(@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 TOTPPrincipal) {
- return username.equals(((TOTPPrincipal) other).getName());
- }
-
- return false;
- }
-
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this).add("username", username).toString();
- }
-
- /** {@inheritDoc} */
- @Override
- public TOTPPrincipal clone() throws CloneNotSupportedException {
- final TOTPPrincipal copy = (TOTPPrincipal) super.clone();
- copy.username = username;
- return copy;
- }
-
-}
\ No newline at end of file
diff --git a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/principal/package-info.java b/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/principal/package-info.java
deleted file mode 100644
index ce752fa..0000000
--- a/totp-impl/src/main/java/net/shibboleth/idp/plugin/totp/principal/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Custom TOTP principal types.
- */
-
-package net.shibboleth.idp.plugin.totp.principal;
\ No newline at end of file
diff --git a/totp-impl/src/test/java/net/shibboleth/idp/plugin/totp/impl/GoogleTOTPAuthenticatorTest.java b/totp-impl/src/test/java/net/shibboleth/idp/plugin/totp/impl/GoogleTOTPAuthenticatorTest.java
index d293e27..29c3561 100644
--- a/totp-impl/src/test/java/net/shibboleth/idp/plugin/totp/impl/GoogleTOTPAuthenticatorTest.java
+++ b/totp-impl/src/test/java/net/shibboleth/idp/plugin/totp/impl/GoogleTOTPAuthenticatorTest.java
@@ -30,8 +30,8 @@ import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
import net.shibboleth.idp.authn.impl.BaseAuthenticationContextTest;
import net.shibboleth.idp.authn.impl.ValidateCredentials;
+import net.shibboleth.idp.authn.principal.TOTPPrincipal;
import net.shibboleth.idp.plugin.totp.context.TOTPContext;
-import net.shibboleth.idp.plugin.totp.principal.TOTPPrincipal;
import net.shibboleth.idp.profile.ActionTestingSupport;
import net.shibboleth.utilities.java.support.codec.Base32Support;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list