[java-identity-provider COMMIT] /trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePas...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Aug 13 12:18:42 EDT 2013
Author: rdw
Date: Tue Aug 13 12:18:41 2013
New Revision: 4681
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4681&view=rev
Log:
Fix an issue with absolute file paths, URIs and windows
Modified:
trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAASTest.java
Modified: trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAASTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAASTest.java?rev=4681&r1=4680&r2=4681&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAASTest.java (original)
+++ trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAASTest.java Tue Aug 13 12:18:41 2013
@@ -17,7 +17,6 @@
package net.shibboleth.idp.authn.impl;
-
import java.io.File;
import java.io.IOException;
import java.net.URI;
@@ -30,6 +29,7 @@
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
import net.shibboleth.idp.authn.context.UsernamePasswordContext;
+import net.shibboleth.utilities.java.support.net.UriSupport;
import org.opensaml.profile.action.ActionTestingSupport;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -48,8 +48,8 @@
/** {@link ValidateUsernamePasswordAgainstJAAS} unit test. */
public class ValidateUsernamePasswordAgainstJAASTest extends InitializeAuthenticationContextTest {
-
- private ValidateUsernamePasswordAgainstJAAS action;
+
+ private ValidateUsernamePasswordAgainstJAAS action;
private InMemoryDirectoryServer directoryServer;
@@ -74,10 +74,10 @@
@AfterClass public void teardownDirectoryServer() {
directoryServer.shutDown(true);
}
-
+
@BeforeMethod public void setUp() throws Exception {
super.setUp();
-
+
action = new ValidateUsernamePasswordAgainstJAAS();
action.setUnknownUsernameErrors(ImmutableList.of("DN_RESOLUTION_FAILURE"));
action.setInvalidPasswordErrors(ImmutableList.of("INVALID_CREDENTIALS"));
@@ -85,15 +85,15 @@
@Test public void testMissingFlow() throws Exception {
action.initialize();
-
+
action.execute(prc);
ActionTestingSupport.assertEvent(prc, AuthnEventIds.INVALID_AUTHN_CTX);
}
-
+
@Test public void testMissingUser() throws Exception {
prc.getSubcontext(AuthenticationContext.class, false).setAttemptedFlow(authenticationFlows.get(0));
action.initialize();
-
+
action.execute(prc);
ActionTestingSupport.assertEvent(prc, AuthnEventIds.NO_CREDENTIALS);
}
@@ -103,7 +103,7 @@
ac.setAttemptedFlow(authenticationFlows.get(0));
ac.getSubcontext(UsernamePasswordContext.class, true);
action.initialize();
-
+
action.execute(prc);
ActionTestingSupport.assertEvent(prc, AuthnEventIds.NO_CREDENTIALS);
}
@@ -117,9 +117,9 @@
AuthenticationContext ac = prc.getSubcontext(AuthenticationContext.class, false);
ac.setAttemptedFlow(authenticationFlows.get(0));
action.initialize();
-
- doExtract(prc);
-
+
+ doExtract(prc);
+
action.execute(prc);
ActionTestingSupport.assertEvent(prc, AuthnEventIds.INVALID_CREDENTIALS);
AuthenticationErrorContext errorCtx = ac.getSubcontext(AuthenticationErrorContext.class, false);
@@ -137,11 +137,12 @@
ac.setAttemptedFlow(authenticationFlows.get(0));
action.setLoginConfigType("JavaLoginConfig");
System.out.println(getCurrentDir());
- action.setLoginConfigParameters(new URIParameter(new URI(getCurrentDir() + "src/test/resources/net/shibboleth/idp/authn/impl/jaas.config")));
- action.initialize();
-
- doExtract(prc);
-
+ action.setLoginConfigParameters(new URIParameter(UriSupport.fileURIFromAbsolutePath(getCurrentDir()
+ + "/src/test/resources/net/shibboleth/idp/authn/impl/jaas.config")));
+ action.initialize();
+
+ doExtract(prc);
+
action.execute(prc);
ActionTestingSupport.assertEvent(prc, AuthnEventIds.INVALID_CREDENTIALS);
AuthenticationErrorContext errorCtx = ac.getSubcontext(AuthenticationErrorContext.class, false);
@@ -160,11 +161,12 @@
ac.setAttemptedFlow(authenticationFlows.get(0));
action.setLoginConfigType("JavaLoginConfig");
System.out.println(getCurrentDir());
- action.setLoginConfigParameters(new URIParameter(new URI(getCurrentDir() + "src/test/resources/net/shibboleth/idp/authn/impl/jaas.config")));
- action.initialize();
-
- doExtract(prc);
-
+ action.setLoginConfigParameters(new URIParameter(UriSupport.fileURIFromAbsolutePath(getCurrentDir()
[... 58 lines stripped ...]
More information about the commits
mailing list