Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WFLY-10614] Fork existing test cases to test authentication using ma…
…ppings to security domains instead of authentication factories.
- Loading branch information
Showing
12 changed files
with
537 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...ion/elytron/src/test/java/org/wildfly/test/integration/elytron/http/FormMechTestBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
/* | |||
* JBoss, Home of Professional Open Source. | |||
* Copyright 2018, Red Hat, Inc., and individual contributors | |||
* as indicated by the @author tags. See the copyright.txt file in the | |||
* distribution for a full listing of individual contributors. | |||
* | |||
* This is free software; you can redistribute it and/or modify it | |||
* under the terms of the GNU Lesser General Public License as | |||
* published by the Free Software Foundation; either version 2.1 of | |||
* the License, or (at your option) any later version. | |||
* | |||
* This software is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with this software; if not, write to the Free | |||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |||
*/ | |||
|
|||
package org.wildfly.test.integration.elytron.http; | |||
|
|||
import org.jboss.arquillian.container.test.api.RunAsClient; | |||
import org.jboss.arquillian.junit.Arquillian; | |||
import org.jboss.as.arquillian.api.ServerSetup; | |||
import org.junit.runner.RunWith; | |||
import org.wildfly.test.security.common.elytron.MechanismConfiguration; | |||
|
|||
/** | |||
* Test of FORM HTTP mechanism. | |||
* | |||
* @author Jan Kalina | |||
*/ | |||
@RunWith(Arquillian.class) | |||
@RunAsClient | |||
@ServerSetup({ FormMechTestBase.ServerSetup.class }) | |||
public class FormMechTestBase extends FormMechTestCase { | |||
|
|||
static class ServerSetup extends AbstractMechTestBase.ServerSetup { | |||
@Override protected MechanismConfiguration getMechanismConfiguration() { | |||
return MechanismConfiguration.builder() | |||
.withMechanismName("FORM") | |||
.build(); | |||
} | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...ron/src/test/java/org/wildfly/test/integration/elytron/http/MinimalBasicMechTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,71 @@ | |||
/* | |||
* JBoss, Home of Professional Open Source. | |||
* Copyright 2018, Red Hat, Inc., and individual contributors | |||
* as indicated by the @author tags. See the copyright.txt file in the | |||
* distribution for a full listing of individual contributors. | |||
* | |||
* This is free software; you can redistribute it and/or modify it | |||
* under the terms of the GNU Lesser General Public License as | |||
* published by the Free Software Foundation; either version 2.1 of | |||
* the License, or (at your option) any later version. | |||
* | |||
* This software is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with this software; if not, write to the Free | |||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |||
*/ | |||
|
|||
package org.wildfly.test.integration.elytron.http; | |||
|
|||
import org.jboss.arquillian.container.test.api.Deployment; | |||
import org.jboss.arquillian.container.test.api.RunAsClient; | |||
import org.jboss.arquillian.junit.Arquillian; | |||
import org.jboss.as.arquillian.api.ServerSetup; | |||
import org.jboss.as.test.integration.security.common.Utils; | |||
import org.jboss.as.test.integration.security.common.servlets.SimpleServlet; | |||
import org.jboss.shrinkwrap.api.ShrinkWrap; | |||
import org.jboss.shrinkwrap.api.spec.WebArchive; | |||
import org.junit.runner.RunWith; | |||
import org.wildfly.test.security.common.elytron.MechanismConfiguration; | |||
|
|||
/** | |||
* Test of BASIC HTTP mechanism using a direct reference to the security domain instead of an authentication factory. | |||
* | |||
* @author Jan Kalina | |||
* @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a> | |||
*/ | |||
@RunWith(Arquillian.class) | |||
@RunAsClient | |||
@ServerSetup({ MinimalBasicMechTestCase.ServerSetup.class }) | |||
public class MinimalBasicMechTestCase extends PasswordMechTestBase { | |||
|
|||
private static final String NAME = MinimalBasicMechTestCase.class.getSimpleName(); | |||
|
|||
@Deployment(testable = false) | |||
public static WebArchive createDeployment() { | |||
return ShrinkWrap.create(WebArchive.class, NAME + ".war") | |||
.addClasses(SimpleServlet.class) | |||
.addAsWebInfResource(Utils.getJBossWebXmlAsset(APP_DOMAIN), "jboss-web.xml") | |||
.addAsWebInfResource(MinimalBasicMechTestCase.class.getPackage(), BasicMechTestCase.class.getSimpleName() + "-web.xml", "web.xml"); | |||
} | |||
|
|||
static class ServerSetup extends AbstractMechTestBase.ServerSetup { | |||
|
|||
@Override | |||
protected boolean useAuthenticationFactory() { | |||
return false; | |||
} | |||
|
|||
@Override | |||
protected MechanismConfiguration getMechanismConfiguration() { | |||
// As we are not using an authentication factory the mechanisms do not require configuration. | |||
return null; | |||
} | |||
|
|||
} | |||
} |
51 changes: 51 additions & 0 deletions
51
...src/test/java/org/wildfly/test/integration/elytron/http/MinimalDigestMechTestCase-web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,51 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
|
|||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" | |||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" | |||
version="3.1"> | |||
|
|||
<servlet> | |||
<servlet-name>SimpleServlet</servlet-name> | |||
<servlet-class>org.jboss.as.test.integration.security.common.servlets.SimpleServlet</servlet-class> | |||
</servlet> | |||
|
|||
<servlet-mapping> | |||
<servlet-name>SimpleServlet</servlet-name> | |||
<url-pattern>/*</url-pattern> | |||
</servlet-mapping> | |||
|
|||
<security-constraint> | |||
<web-resource-collection> | |||
<web-resource-name>Role1</web-resource-name> | |||
<url-pattern>/role1</url-pattern> | |||
</web-resource-collection> | |||
<auth-constraint> | |||
<role-name>Role1</role-name> | |||
</auth-constraint> | |||
</security-constraint> | |||
|
|||
<security-constraint> | |||
<web-resource-collection> | |||
<web-resource-name>Role2</web-resource-name> | |||
<url-pattern>/role2</url-pattern> | |||
</web-resource-collection> | |||
<auth-constraint> | |||
<role-name>Role2</role-name> | |||
</auth-constraint> | |||
</security-constraint> | |||
|
|||
<login-config> | |||
<auth-method>DIGEST</auth-method> | |||
<realm-name>Digest kingdom</realm-name> | |||
</login-config> | |||
|
|||
|
|||
<security-role> | |||
<role-name>Role1</role-name> | |||
</security-role> | |||
<security-role> | |||
<role-name>Role2</role-name> | |||
</security-role> | |||
|
|||
</web-app> |
71 changes: 71 additions & 0 deletions
71
...on/src/test/java/org/wildfly/test/integration/elytron/http/MinimalDigestMechTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,71 @@ | |||
/* | |||
* JBoss, Home of Professional Open Source. | |||
* Copyright 2018, Red Hat, Inc., and individual contributors | |||
* as indicated by the @author tags. See the copyright.txt file in the | |||
* distribution for a full listing of individual contributors. | |||
* | |||
* This is free software; you can redistribute it and/or modify it | |||
* under the terms of the GNU Lesser General Public License as | |||
* published by the Free Software Foundation; either version 2.1 of | |||
* the License, or (at your option) any later version. | |||
* | |||
* This software is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public | |||
* License along with this software; if not, write to the Free | |||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |||
*/ | |||
|
|||
package org.wildfly.test.integration.elytron.http; | |||
|
|||
import org.jboss.arquillian.container.test.api.Deployment; | |||
import org.jboss.arquillian.container.test.api.RunAsClient; | |||
import org.jboss.arquillian.junit.Arquillian; | |||
import org.jboss.as.arquillian.api.ServerSetup; | |||
import org.jboss.as.test.integration.security.common.Utils; | |||
import org.jboss.as.test.integration.security.common.servlets.SimpleServlet; | |||
import org.jboss.shrinkwrap.api.ShrinkWrap; | |||
import org.jboss.shrinkwrap.api.spec.WebArchive; | |||
import org.junit.runner.RunWith; | |||
import org.wildfly.test.security.common.elytron.MechanismConfiguration; | |||
|
|||
/** | |||
* Test of DIGEST HTTP mechanism using a direct reference to the security domain instead of an authentication factory. | |||
* | |||
* @author Jan Kalina | |||
* @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a> | |||
*/ | |||
@RunWith(Arquillian.class) | |||
@RunAsClient | |||
@ServerSetup({ MinimalDigestMechTestCase.ServerSetup.class }) | |||
public class MinimalDigestMechTestCase extends PasswordMechTestBase { | |||
|
|||
private static final String NAME = MinimalDigestMechTestCase.class.getSimpleName(); | |||
|
|||
@Deployment(testable = false) | |||
public static WebArchive createDeployment() { | |||
return ShrinkWrap.create(WebArchive.class, NAME + ".war") | |||
.addClasses(SimpleServlet.class) | |||
.addAsWebInfResource(Utils.getJBossWebXmlAsset(APP_DOMAIN), "jboss-web.xml") | |||
.addAsWebInfResource(MinimalDigestMechTestCase.class.getPackage(), NAME + "-web.xml", "web.xml"); | |||
} | |||
|
|||
static class ServerSetup extends AbstractMechTestBase.ServerSetup { | |||
|
|||
@Override | |||
protected boolean useAuthenticationFactory() { | |||
return false; | |||
} | |||
|
|||
@Override | |||
protected MechanismConfiguration getMechanismConfiguration() { | |||
// As we are not using an authentication factory the mechanisms do not require configuration. | |||
return null; | |||
} | |||
|
|||
} | |||
} |
Oops, something went wrong.