[java-identity-provider COMMIT] in /trunk: idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthentic...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Sep 16 13:47:49 EDT 2015
Author: scantor
Date: Wed Sep 16 13:47:48 2015
New Revision: 7758
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7758&view=rev
Log:
IDP-800 - unit tests
Modified:
trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java
trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java
trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/profile/impl/InitializeAuthenticationContextTest.java
Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java?rev=7758&r1=7757&r2=7758&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlow.java Wed Sep 16 13:47:48 2015
@@ -33,6 +33,7 @@
import net.shibboleth.idp.authn.principal.PrincipalEvalPredicate;
import net.shibboleth.idp.authn.principal.PrincipalEvalPredicateFactory;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.component.ComponentSupport;
import org.opensaml.profile.action.ActionSupport;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -100,6 +101,8 @@
* @param flag whether SSO should trump explicit relying party flow preference
*/
public void setFavorSSO(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
favorSSO = flag;
}
Modified: trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java?rev=7758&r1=7757&r2=7758&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java (original)
+++ trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/SelectAuthenticationFlowTest.java Wed Sep 16 13:47:48 2015
@@ -30,6 +30,7 @@
import net.shibboleth.idp.authn.principal.TestPrincipal;
import net.shibboleth.idp.authn.principal.impl.ExactPrincipalEvalPredicateFactory;
import net.shibboleth.idp.profile.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import org.springframework.webflow.execution.Event;
import org.testng.Assert;
@@ -86,6 +87,19 @@
Assert.assertEquals(active, authCtx.getAuthenticationResult());
}
+ @Test public void testNoRequestInitialForced() {
+ final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
+ final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class, false);
+ 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, false);
@@ -162,6 +176,50 @@
Assert.assertEquals(authCtx.getAttemptedFlow(), authCtx.getPotentialFlows().get("test3"));
}
+ @Test public void testRequestPickInactiveInitial() {
+ final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class, false);
+ final List<Principal> principals = Arrays.<Principal>asList(new TestPrincipal("test3"),
+ new TestPrincipal("test2"));
+ final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
+ 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.execute(src);
+
+ Assert.assertNull(authCtx.getAuthenticationResult());
+ Assert.assertEquals(authCtx.getAttemptedFlow(), authCtx.getPotentialFlows().get("test3"));
+ }
+
[... 146 lines stripped ...]
More information about the commits
mailing list