[java-identity-provider] branch master updated: IDP-1397 - Removal of deprecated features

Scott Cantor cantor.2 at osu.edu
Thu Jan 10 14:02:06 EST 2019


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

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

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

The following commit(s) were added to refs/heads/master by this push:
       new  2b6e947   IDP-1397 - Removal of deprecated features
2b6e947 is described below

commit 2b6e94757ed2b190bcde7cd8360f03c51f6f57df
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jan 10 14:02:03 2019 -0500

    IDP-1397 - Removal of deprecated features
    
    https://issues.shibboleth.net/jira/browse/IDP-1397
    
    Complete? removal of initial authentication feature.
---
 .../idp/authn/context/AuthenticationContext.java   | 29 --------
 .../idp/authn/impl/SelectAuthenticationFlow.java   | 24 +------
 .../authn/impl/SelectAuthenticationFlowTest.java   | 84 ----------------------
 .../impl/BuildAuthenticationContextAction.java     | 11 ---
 .../impl/InitializeAuthenticationContext.java      | 10 ---
 .../impl/InitializeAuthenticationContextTest.java  | 29 --------
 6 files changed, 1 insertion(+), 186 deletions(-)

diff --git a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java
index a88bbbc..ccadb5d 100644
--- a/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java
+++ b/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java
@@ -108,9 +108,6 @@ public final class AuthenticationContext extends BaseContext {
 
     /** Storage map for interflow communication. */
     @Nonnull private final Map<String,Object> stateMap;
-    
-    /** A successful "initial" authentication result from the current request's initial-authn phase. */
-    @Nullable private AuthenticationResult initialAuthenticationResult;
 
     /** A successful authentication result (the output of the attempted flow, if any). */
     @Nullable private AuthenticationResult authenticationResult;
@@ -459,31 +456,6 @@ public final class AuthenticationContext extends BaseContext {
     }
     
     /**
-     * Get the "initial" authentication result produced during this request's initial-authn phase.
-     * 
-     * <p>This is used to make a previous result available for SSO even if the "forced authentication"
-     * feature is being used, since the result was produced as part of the same request.</p>
-     * 
-     * @return "initial" authentication result, if any
-     */
-    @Nullable public AuthenticationResult getInitialAuthenticationResult() {
-        return initialAuthenticationResult;
-    }
-
-    /**
-     * Set the "initial" authentication result produced during this request's initial-authn phase.
-     * 
-     * @param result "initial" authentication result, if any
-     * 
-     * @return this authentication context
-     */
-    @Nonnull public AuthenticationContext setInitialAuthenticationResult(
-            @Nullable final AuthenticationResult result) {
-        initialAuthenticationResult = result;
-        return this;
-    }
-    
-    /**
      * Get the authentication result produced by the attempted flow, or reused for SSO.
      * 
      * <p>The last flow to complete successfully should have its results stored here. Composite
@@ -719,7 +691,6 @@ public final class AuthenticationContext extends BaseContext {
                 .add("signaledFlowId", signaledFlowId)
                 .add("authenticationStateMap", stateMap)
                 .add("resultCacheable", resultCacheable)
-                .add("initialAuthenticationResult", initialAuthenticationResult)
                 .add("authenticationResult", authenticationResult)
                 .add("completionInstant", new DateTime(completionInstant))
                 .toString();
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java
index 60de1f0..e96ae69 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java
@@ -18,7 +18,6 @@
 package net.shibboleth.idp.authn.impl;
 
 import java.security.Principal;
-import java.util.Collections;
 import java.util.Map;
 
 import javax.annotation.Nonnull;
@@ -190,10 +189,6 @@ public class SelectAuthenticationFlow extends AbstractAuthenticationAction {
         final AuthenticationResult activeResult;
         if (!authenticationContext.isForceAuthn() && flow.getReuseCondition().apply(profileRequestContext)) {
             activeResult = authenticationContext.getActiveResults().get(flow.getId());
-        } else if (authenticationContext.getInitialAuthenticationResult() != null
-                && authenticationContext.getInitialAuthenticationResult().getAuthenticationFlowId().equals(
-                        flow.getId())) {
-            activeResult = authenticationContext.getInitialAuthenticationResult();
         } else {
             activeResult = null;
         }
@@ -263,15 +258,6 @@ public class SelectAuthenticationFlow extends AbstractAuthenticationAction {
         
         log.debug("{} No specific Principals requested", getLogPrefix());
         
-        // Check for initial authentication (valid even in presence of forced authentication).
-        if (authenticationContext.getInitialAuthenticationResult() != null
-                && authenticationContext.getPotentialFlows().containsKey(
-                        authenticationContext.getInitialAuthenticationResult().getAuthenticationFlowId())) {
-            selectActiveResult(profileRequestContext, authenticationContext,
-                    authenticationContext.getInitialAuthenticationResult());
-            return;
-        }
-        
         if (authenticationContext.isForceAuthn()) {
             log.debug("{} Forced authentication requested, selecting an inactive flow", getLogPrefix());
             final AuthenticationFlowDescriptor flow =
@@ -396,15 +382,7 @@ public class SelectAuthenticationFlow extends AbstractAuthenticationAction {
                 requestedPrincipalCtx.getOperator(), requestedPrincipalCtx.getRequestedPrincipals());
 
         
-        if (authenticationContext.getInitialAuthenticationResult() != null
-                && authenticationContext.getPotentialFlows().containsKey(
-                        authenticationContext.getInitialAuthenticationResult().getAuthenticationFlowId())) {
-            // Invoke possible SSO but with the initial result as the only possible reuse option.
-            selectRequestedFlow(profileRequestContext, authenticationContext,
-                    Collections.singletonMap(
-                            authenticationContext.getInitialAuthenticationResult().getAuthenticationFlowId(),
-                            authenticationContext.getInitialAuthenticationResult()));
-        } else if (authenticationContext.isForceAuthn()) {
+        if (authenticationContext.isForceAuthn()) {
             log.debug("{} Forced authentication requested, selecting an inactive flow", getLogPrefix());
             selectRequestedInactiveFlow(profileRequestContext, authenticationContext);
         } else if (authenticationContext.getActiveResults().isEmpty()) {
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java
index 1232ed4..ba000a2 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java
@@ -98,19 +98,6 @@ public class SelectAuthenticationFlowTest extends BaseAuthenticationContextTest
         Assert.assertEquals(active, authCtx.getAuthenticationResult());
     }
 
-    @Test public void testNoRequestInitialForced() {
-        final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
-        final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
-        authCtx.setForceAuthn(true);
-        authCtx.setInitialAuthenticationResult(active);
-        authCtx.setActiveResults(Arrays.asList(active));
-        
-        final Event event = action.execute(src);
-        
-        ActionTestingSupport.assertProceedEvent(event);
-        Assert.assertEquals(active, authCtx.getAuthenticationResult());
-    }
-
     @Test public void testNoRequestForced() {
         final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
         final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
@@ -164,27 +151,6 @@ public class SelectAuthenticationFlowTest extends BaseAuthenticationContextTest
         Assert.assertEquals(authCtx.getAttemptedFlow().getId(), "test3");
     }
     
-    @Test public void testPreferredPickActiveInitialNonMatch() throws ComponentInitializationException {
-        final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
-        final List<Principal> principals = Arrays.<Principal>asList(new TestPrincipal("test3"),
-                new TestPrincipal("test2"));
-        final PreferredPrincipalContext ppc = new PreferredPrincipalContext();
-        ppc.setPreferredPrincipals(principals);
-        authCtx.addSubcontext(ppc, true);
-        final AuthenticationResult active = new AuthenticationResult("test1", new Subject());
-        active.getSubject().getPrincipals().add(new TestPrincipal("test1"));
-        authCtx.setActiveResults(Arrays.asList(active));
-        authCtx.setInitialAuthenticationResult(active);
-        authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(ImmutableList.of(principals.get(0)));
-        
-        action = new SelectAuthenticationFlow();
-        action.initialize();
-        final Event event = action.execute(src);
-        ActionTestingSupport.assertProceedEvent(event);
-        
-        Assert.assertEquals(active, authCtx.getAuthenticationResult());
-    }
-    
     @Test public void testPreferredPickActiveNonMatch() {
         final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
         final List<Principal> principals = Arrays.<Principal>asList(new TestPrincipal("test3"),
@@ -284,56 +250,6 @@ public class SelectAuthenticationFlowTest extends BaseAuthenticationContextTest
         Assert.assertEquals(authCtx.getAttemptedFlow(), authCtx.getPotentialFlows().get("test3"));
     }
 
-    @Test public void testRequestPickInactiveInitial() {
-        final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
-        final List<Principal> principals = Arrays.<Principal>asList(new TestPrincipal("test3"),
-                new TestPrincipal("test2"));
-        final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
-        rpc.getPrincipalEvalPredicateFactoryRegistry().register(
-                TestPrincipal.class, "exact", new ExactPrincipalEvalPredicateFactory());
-        rpc.setOperator("exact");
-        rpc.setRequestedPrincipals(principals);
-        authCtx.addSubcontext(rpc, true);
-        final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
-        active.getSubject().getPrincipals().add(new TestPrincipal("test2"));
-        authCtx.setActiveResults(Arrays.asList(active));
-        authCtx.setInitialAuthenticationResult(active);
-        authCtx.setForceAuthn(true);
-        authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(ImmutableList.of(principals.get(0)));
-        
-        final Event event = action.execute(src);
-        ActionTestingSupport.assertEvent(event, "test3");
-        
-        Assert.assertNull(authCtx.getAuthenticationResult());
-        Assert.assertEquals(authCtx.getAttemptedFlow(), authCtx.getPotentialFlows().get("test3"));
-    }
-
-    @Test public void testRequestPickActiveInitial() throws ComponentInitializationException {
-        final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
-        final List<Principal> principals = Arrays.<Principal>asList(new TestPrincipal("test3"),
-                new TestPrincipal("test2"));
-        final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
-        rpc.getPrincipalEvalPredicateFactoryRegistry().register(
-                TestPrincipal.class, "exact", new ExactPrincipalEvalPredicateFactory());
-        rpc.setOperator("exact");
-        rpc.setRequestedPrincipals(principals);
-        authCtx.addSubcontext(rpc, true);
-        final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
-        active.getSubject().getPrincipals().add(new TestPrincipal("test2"));
-        authCtx.setActiveResults(Arrays.asList(active));
-        authCtx.setInitialAuthenticationResult(active);
-        authCtx.setForceAuthn(true);
-        authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(ImmutableList.of(principals.get(0)));
-        
-        action = new SelectAuthenticationFlow();
-        action.setFavorSSO(true);
-        action.initialize();
-        final Event event = action.execute(src);
-        ActionTestingSupport.assertProceedEvent(event);
-        
-        Assert.assertEquals(active, authCtx.getAuthenticationResult());
-    }
-
     @Test public void testRequestPickActive() {
         final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
         final List<Principal> principals = Arrays.<Principal>asList(new TestPrincipal("test3"),
diff --git a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/BuildAuthenticationContextAction.java b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/BuildAuthenticationContextAction.java
index 6f87a52..55e332a 100644
--- a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/BuildAuthenticationContextAction.java
+++ b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/BuildAuthenticationContextAction.java
@@ -19,7 +19,6 @@ package net.shibboleth.idp.cas.flow.impl;
 
 import javax.annotation.Nonnull;
 
-import net.shibboleth.idp.authn.AuthenticationResult;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.cas.config.impl.ConfigLookupFunction;
 import net.shibboleth.idp.cas.config.impl.LoginConfiguration;
@@ -32,10 +31,6 @@ import org.springframework.webflow.execution.RequestContext;
 
 /**
  * Builds an authentication context from an incoming {@link ServiceTicketRequest} message.
- * 
- * <p>If a previously populated {@link AuthenticationContext} is found, and it contains a successful
- * {@link AuthenticationResult}, that result is copied to the new context via
- * {@link AuthenticationContext#setInitialAuthenticationResult(net.shibboleth.idp.authn.AuthenticationResult)}.</p>
  *
  * @author Marvin S. Addison
  */
@@ -62,12 +57,6 @@ public class BuildAuthenticationContextAction extends
             }
         }
         
-        final AuthenticationContext initialAuthnContext =
-                profileRequestContext.getSubcontext(AuthenticationContext.class);
-        if (initialAuthnContext != null) {
-            ac.setInitialAuthenticationResult(initialAuthnContext.getAuthenticationResult());
-        }
-        
         profileRequestContext.addSubcontext(ac, true);
         profileRequestContext.setBrowserProfile(true);
         return null;
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContext.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContext.java
index 9109182..6b4c155 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContext.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContext.java
@@ -43,10 +43,6 @@ import com.google.common.base.Predicate;
  * <p>If the incoming message is a SAML 2.0 {@link AuthnRequest}, then basic authentication policy (IsPassive,
  * ForceAuthn) is copied into the context from the request.</p>
  * 
- * <p>If a previously populated {@link AuthenticationContext} is found, and it contains a successful
- * {@link net.shibboleth.idp.authn.AuthenticationResult}, that result is copied to the new context via
- * {@link AuthenticationContext#setInitialAuthenticationResult(net.shibboleth.idp.authn.AuthenticationResult)}.</p>
- * 
  * @event {@link org.opensaml.profile.action.EventIds#PROCEED_EVENT_ID}
  * @post ProfileRequestContext.getSubcontext(AuthenticationContext.class) != true
  * @post SAML 2.0 AuthnRequest policy flags are copied to the {@link AuthenticationContext}
@@ -123,12 +119,6 @@ public class InitializeAuthenticationContext extends AbstractProfileAction {
             authnCtx.setIsPassive(authnRequest.isPassive());
         }
 
-        final AuthenticationContext initialAuthnContext =
-                profileRequestContext.getSubcontext(AuthenticationContext.class);
-        if (initialAuthnContext != null) {
-            authnCtx.setInitialAuthenticationResult(initialAuthnContext.getAuthenticationResult());
-        }
-        
         if (!authnCtx.isForceAuthn()) {
             authnCtx.setForceAuthn(forceAuthnPredicate.apply(profileRequestContext));
         }
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContextTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContextTest.java
index 9be52ce..558fca5 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContextTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContextTest.java
@@ -17,14 +17,11 @@
 
 package net.shibboleth.idp.saml.profile.impl;
 
-import net.shibboleth.idp.authn.AuthenticationResult;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.profile.ActionTestingSupport;
 import net.shibboleth.idp.profile.RequestContextBuilder;
 import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
 
-import javax.security.auth.Subject;
-
 import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.opensaml.saml.common.SAMLObjectBuilder;
@@ -53,7 +50,6 @@ public class InitializeAuthenticationContextTest {
         Assert.assertNotNull(authnCtx);
         Assert.assertFalse(authnCtx.isForceAuthn());
         Assert.assertFalse(authnCtx.isPassive());
-        Assert.assertNull(authnCtx.getInitialAuthenticationResult());
     }
 
     /** Test that the action functions properly if there is no inbound message. */
@@ -71,7 +67,6 @@ public class InitializeAuthenticationContextTest {
         Assert.assertNotNull(authnCtx);
         Assert.assertFalse(authnCtx.isForceAuthn());
         Assert.assertFalse(authnCtx.isPassive());
-        Assert.assertNull(authnCtx.getInitialAuthenticationResult());
     }
 
     /** Test that the action functions properly if the inbound message is not a SAML 2 AuthnRequest. */
@@ -92,7 +87,6 @@ public class InitializeAuthenticationContextTest {
         Assert.assertNotNull(authnCtx);
         Assert.assertFalse(authnCtx.isForceAuthn());
         Assert.assertFalse(authnCtx.isPassive());
-        Assert.assertNull(authnCtx.getInitialAuthenticationResult());
     }
 
     /** Test that the action proceeds properly if the inbound message is a SAML2 AuthnRequest. */
@@ -118,29 +112,6 @@ public class InitializeAuthenticationContextTest {
         Assert.assertNotNull(authnCtx);
         Assert.assertTrue(authnCtx.isForceAuthn());
         Assert.assertTrue(authnCtx.isPassive());
-        Assert.assertNull(authnCtx.getInitialAuthenticationResult());
     }
 
-    /** Test that the action functions properly if there's an initial result already. */
-    @Test public void testInitialResult() throws Exception {
-        final RequestContext requestCtx = new RequestContextBuilder().buildRequestContext();
-        final ProfileRequestContext prc = new WebflowRequestContextProfileRequestContextLookup().apply(requestCtx);
-        prc.setInboundMessageContext(null);
-
-        final InitializeAuthenticationContext action = new InitializeAuthenticationContext();
-        action.initialize();
-
-        final AuthenticationResult result = new AuthenticationResult("test", new Subject());
-        prc.getSubcontext(AuthenticationContext.class, true).setAuthenticationResult(result);
-        
-        final Event event = action.execute(requestCtx);
-        ActionTestingSupport.assertProceedEvent(event);
-
-        final AuthenticationContext authnCtx = prc.getSubcontext(AuthenticationContext.class);
-        Assert.assertNotNull(authnCtx);
-        Assert.assertFalse(authnCtx.isForceAuthn());
-        Assert.assertFalse(authnCtx.isPassive());
-        Assert.assertNotNull(authnCtx.getInitialAuthenticationResult());
-        Assert.assertEquals(authnCtx.getInitialAuthenticationResult(), result);
-    }
 }
\ 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