[java-idp-plugin-duo] branch main updated: Replace new DuoPrincipal with existing idp-authn version
Phil Smart
philip.smart at jisc.ac.uk
Wed Aug 26 12:44:14 UTC 2020
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-idp-plugin-duo.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-duo.git;a=commit;h=736fb112e7ac3257a859fbc25d71a5937ab67a52
The following commit(s) were added to refs/heads/main by this push:
new 736fb11 Replace new DuoPrincipal with existing idp-authn version
736fb11 is described below
commit 736fb112e7ac3257a859fbc25d71a5937ab67a52
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Aug 26 13:44:06 2020 +0100
Replace new DuoPrincipal with existing idp-authn version
---
.../authn/duo/principal/DuoOIDCPrincipal.java | 93 ----------------------
.../impl/ValidateDuoTokenAuthenticationResult.java | 4 +-
2 files changed, 2 insertions(+), 95 deletions(-)
diff --git a/idp-duo-api/src/main/java/net/shbboleth/idp/plugin/authn/duo/principal/DuoOIDCPrincipal.java b/idp-duo-api/src/main/java/net/shbboleth/idp/plugin/authn/duo/principal/DuoOIDCPrincipal.java
deleted file mode 100644
index 121c06e..0000000
--- a/idp-duo-api/src/main/java/net/shbboleth/idp/plugin/authn/duo/principal/DuoOIDCPrincipal.java
+++ /dev/null
@@ -1,93 +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.shbboleth.idp.plugin.authn.duo.principal;
-
-import javax.annotation.Nonnull;
-import javax.annotation.concurrent.Immutable;
-
-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;
-
-
-/** Principal based on a Duo OIDC based authentication. */
- at Immutable
-public final class DuoOIDCPrincipal implements CloneablePrincipal {
-
- /** The username. */
- @Nonnull @NotEmpty private final String username;
-
- /**
- * Constructor.
- *
- * @param name the username
- */
- public DuoOIDCPrincipal(@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 DuoOIDCPrincipal) {
- return username.equals(((DuoOIDCPrincipal) other).getName());
- }
-
- return false;
- }
-
-
-
- /** {@inheritDoc} */
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append("DuoOIDCPrincipal [username=");
- builder.append(username);
- builder.append("]");
- return builder.toString();
- }
-
- /** {@inheritDoc} */
- @Override
- public DuoOIDCPrincipal clone() throws CloneNotSupportedException {
- return new DuoOIDCPrincipal(username);
- }
-}
\ No newline at end of file
diff --git a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateDuoTokenAuthenticationResult.java b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateDuoTokenAuthenticationResult.java
index 0602ce0..27e2963 100644
--- a/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateDuoTokenAuthenticationResult.java
+++ b/idp-duo-impl/src/main/java/net/shibboleth/idp/plugin/authn/duo/impl/ValidateDuoTokenAuthenticationResult.java
@@ -33,12 +33,12 @@ import org.slf4j.LoggerFactory;
import net.shbboleth.idp.plugin.authn.duo.DuoOIDCAuthAPI;
import net.shbboleth.idp.plugin.authn.duo.context.DuoOIDCAuthenticationContext;
import net.shbboleth.idp.plugin.authn.duo.model.DuoAuthToken;
-import net.shbboleth.idp.plugin.authn.duo.principal.DuoOIDCPrincipal;
import net.shibboleth.idp.authn.AbstractValidationAction;
import net.shibboleth.idp.authn.AuthenticationResult;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
+import net.shibboleth.idp.authn.duo.DuoPrincipal;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
@@ -158,7 +158,7 @@ public class ValidateDuoTokenAuthenticationResult extends AbstractValidationActi
@Override protected Subject populateSubject(@Nonnull final Subject subject) {
//Always add the custom Duo principal
- subject.getPrincipals().add(new DuoOIDCPrincipal(username));
+ subject.getPrincipals().add(new DuoPrincipal(username));
//Always add any principals specified on the integration
subject.getPrincipals().addAll(duoContext.getIntegration().getSupportedPrincipals(Principal.class));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list