Skip to content

Commit

Permalink
Merge pull request #145 from arjantijms/tck_refactor_custom_policy
Browse files Browse the repository at this point in the history
Slightly refactor first two policy tests
  • Loading branch information
arjantijms committed Mar 12, 2024
2 parents 97782ef + fc62fc3 commit 2f48281
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion tck/app-policy/pom.xml → tck/app-custom-policy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<version>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>app-mem-policy</artifactId>
<artifactId>app-custom-policy</artifactId>
<packaging>war</packaging>

<description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*
* <p>
* The role "foo" is required to access this Servlet. "bar" is a role assigned by the
* TestIdentityStore, "kaz" doesn't exist (but we should still be able to test for it).
* native identity store, "kaz" doesn't exist (but we should still be able to test for it).
*
*/
@WebServlet("/protectedServlet/*")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@


@RunWith(Arquillian.class)
public class AppPolicyIT extends ArquillianBase {
public class AppCustomPolicyIT extends ArquillianBase {

@Deployment(testable = false)
public static Archive<?> createDeployment() {
Expand Down
4 changes: 2 additions & 2 deletions tck/app-policy2/pom.xml → tck/app-custom-policy2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
<version>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>app-mem-policy2</artifactId>
<artifactId>app-custom-policy2</artifactId>
<packaging>war</packaging>

<description>
This tests executing a custom permission check before authentication takes place.
This tests executing a custom permission check afer authentication takes place.
</description>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* this caller is in any of the roles {foo, bar, kaz}
*
* <p>
* The role "kaz" is required to access this Servlet. "bar" is a role assigned by the
* TestIdentityStore.
* The role "kaz" is required to access this Servlet. "foo" and "bar" are roles assigned
* by the native identity store.
*
*/
@WebServlet("/protectedServlet/*")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


@RunWith(Arquillian.class)
public class AppPolicy2IT extends ArquillianBase {
public class AppCustomPolicy2IT extends ArquillianBase {

@Deployment(testable = false)
public static Archive<?> createDeployment() {
Expand All @@ -43,10 +43,10 @@ public static Archive<?> createDeployment() {

/**
* Normally authenticated for a request to the default path.
* Should not have access, since not in role "kaz"
* But should not have access, since not in role "kaz"
*/
@Test
public void testAuthenticated() {
public void testAuthenticatedWrongRole() {
DefaultCredentialsProvider credentialsProvider = new DefaultCredentialsProvider();
credentialsProvider.addCredentials("reza", "secret1");

Expand All @@ -58,7 +58,8 @@ public void testAuthenticated() {

/**
* Not authenticated on the default path.
* Should not have access, since not in the required role "kaz"
* Should not have access, since unauthenticated caller is of course
* not in the required role "kaz"
*/
@Test
public void testNotAuthenticated() {
Expand Down
4 changes: 2 additions & 2 deletions tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
<module>common</module>

<!-- Setting a Jakarta Authorization policy -->
<module>app-policy</module>
<module>app-policy2</module>
<module>app-custom-policy</module>
<module>app-custom-policy2</module>
<module>app-policy3</module>
</modules>

Expand Down

0 comments on commit 2f48281

Please sign in to comment.