Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

import jakarta.security.enterprise.authentication.mechanism.http.HttpAuthenticationMechanismHandler;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;


/**
Expand All @@ -37,7 +37,7 @@
* {@code secret} to take the credentials from, while for all other paths {@code name} and
* {@code password} is used.
*/
@RunWith(Arquillian.class)
@ExtendWith(ArquillianExtension.class)
public class AppCustomAuthenticationMechanismHandlerIT extends ArquillianBase {

@Deployment(testable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@

import static ee.jakarta.tck.security.test.Assert.assertDefaultAuthenticated;
import static ee.jakarta.tck.security.test.ShrinkWrap.mavenWar;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.htmlunit.DefaultCredentialsProvider;
import org.htmlunit.WebResponse;
import jakarta.security.enterprise.authentication.mechanism.http.HttpAuthenticationMechanismHandler;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;


/**
Expand All @@ -39,7 +39,7 @@
* In this test, three instances of the build-in Basic HTTP authentication mechanism are used. The custom
* handler invokes each one depending on the request URI that was used.
*/
@RunWith(Arquillian.class)
@ExtendWith(ArquillianExtension.class)
public class AppCustomAuthenticationMechanismHandler2IT extends ArquillianBase {

@Deployment(testable = false)
Expand All @@ -57,15 +57,15 @@ public void testAuthenticated1() {
assertEquals(401, response.getStatusCode());

assertTrue(
"Response did not contain the \"WWW-Authenticate\" header, but should have",
response.getResponseHeaderValue("WWW-Authenticate") != null);
response.getResponseHeaderValue("WWW-Authenticate") != null,
"Response did not contain the \"WWW-Authenticate\" header, but should have");


// Most important part of the test: check that we have the correct authentication mechanism instance used

assertTrue(
"Response did not contain \"realm1\" in the \"WWW-Authenticate\" header value, but should have",
response.getResponseHeaderValue("WWW-Authenticate").contains("realm1"));
response.getResponseHeaderValue("WWW-Authenticate").contains("realm1"),
"Response did not contain \"realm1\" in the \"WWW-Authenticate\" header value, but should have");


// For completion, check that authentication mechanism also actually authenticates
Expand All @@ -89,15 +89,15 @@ public void testAuthenticated2() {
assertEquals(401, response.getStatusCode());

assertTrue(
"Response did not contain the \"WWW-Authenticate\" header, but should have",
response.getResponseHeaderValue("WWW-Authenticate") != null);
response.getResponseHeaderValue("WWW-Authenticate") != null,
"Response did not contain the \"WWW-Authenticate\" header, but should have");


// Most important part of the test: check that we have the correct authentication mechanism instance used

assertTrue(
"Response did not contain \"realm1\" in the \"WWW-Authenticate\" header value, but should have",
response.getResponseHeaderValue("WWW-Authenticate").contains("realm2"));
response.getResponseHeaderValue("WWW-Authenticate").contains("realm2"),
"Response did not contain \"realm1\" in the \"WWW-Authenticate\" header value, but should have");


// For completion, check that authentication mechanism also actually authenticates
Expand All @@ -121,15 +121,15 @@ public void testAuthenticated3() {
assertEquals(401, response.getStatusCode());

assertTrue(
"Response did not contain the \"WWW-Authenticate\" header, but should have",
response.getResponseHeaderValue("WWW-Authenticate") != null);
response.getResponseHeaderValue("WWW-Authenticate") != null,
"Response did not contain the \"WWW-Authenticate\" header, but should have");


// Most important part of the test: check that we have the correct authentication mechanism instance used

assertTrue(
"Response did not contain \"realm3\" in the \"WWW-Authenticate\" header value, but should have",
response.getResponseHeaderValue("WWW-Authenticate").contains("realm3"));
response.getResponseHeaderValue("WWW-Authenticate").contains("realm3"),
"Response did not contain \"realm3\" in the \"WWW-Authenticate\" header value, but should have");


// For completion, check that authentication mechanism also actually authenticates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
import static ee.jakarta.tck.security.test.ShrinkWrap.mavenWar;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;


@RunWith(Arquillian.class)
@ExtendWith(ArquillianExtension.class)
public class AppCustomIdentityStoreHandlerIT extends ArquillianBase {

@Deployment(testable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
import static ee.jakarta.tck.security.test.Assert.assertDefaultAuthenticated;
import static ee.jakarta.tck.security.test.Assert.assertDefaultNotAuthenticated;
import static ee.jakarta.tck.security.test.ShrinkWrap.mavenWar;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import ee.jakarta.tck.security.test.alternatives.TestAuthenticationMechanismHttpOnlyFalse;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import org.htmlunit.util.Cookie;


@RunWith(Arquillian.class)
@ExtendWith(ArquillianExtension.class)
public class AppCustomRememberMeHttpOnlyIT extends ArquillianBase {

@Deployment(testable = false)
Expand Down Expand Up @@ -92,8 +92,8 @@ public void testAuthenticatedRememberMe() {
// For the initial authentication, the mechanism should be called

assertTrue(
"Authentication mechanism should have been called, but wasn't",
response.contains("authentication mechanism called: true"));
response.contains("authentication mechanism called: true"),
"Authentication mechanism should have been called, but wasn't");


// 3. Request same page again within same http session, without remember me
Expand All @@ -115,8 +115,8 @@ public void testAuthenticatedRememberMe() {
// For the initial authentication, the mechanism should be called again

assertTrue(
"Authentication mechanism should have been called, but wasn't",
response.contains("authentication mechanism called: true"));
response.contains("authentication mechanism called: true"),
"Authentication mechanism should have been called, but wasn't");


// 5. Request same page again within same http session, with remember me
Expand All @@ -131,8 +131,8 @@ public void testAuthenticatedRememberMe() {
// (the remember me interceptor takes care of this)

assertTrue(
"Authentication mechanism should not have been called, but was",
response.contains("authentication mechanism called: false"));
response.contains("authentication mechanism called: false"),
"Authentication mechanism should not have been called, but was");


// 6. "Expire" the session by removing all cookies except the
Expand All @@ -157,8 +157,8 @@ public void testAuthenticatedRememberMe() {
// (the remember me interceptor takes care of this)

assertTrue(
"Authentication mechanism should not have been called, but was",
response.contains("authentication mechanism called: false"));
response.contains("authentication mechanism called: false"),
"Authentication mechanism should not have been called, but was");


// 7. Logout. Should not be authenticated anymore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
import static ee.jakarta.tck.security.test.Assert.assertDefaultAuthenticated;
import static ee.jakarta.tck.security.test.Assert.assertDefaultNotAuthenticated;
import static ee.jakarta.tck.security.test.ShrinkWrap.mavenWar;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import org.htmlunit.util.Cookie;

import ee.jakarta.tck.security.test.alternatives.TestAuthenticationMechanismHttpOnlyFalseImmediate;


@RunWith(Arquillian.class)
@ExtendWith(ArquillianExtension.class)
public class AppCustomRememberMeHttpOnlyImmediateIT extends ArquillianBase {

@Deployment(testable = false)
Expand Down Expand Up @@ -93,8 +93,8 @@ public void testAuthenticatedRememberMe() {
// For the initial authentication, the mechanism should be called

assertTrue(
"Authentication mechanism should have been called, but wasn't",
response.contains("authentication mechanism called: true"));
response.contains("authentication mechanism called: true"),
"Authentication mechanism should have been called, but wasn't");


// 3. Request same page again within same http session, without remember me
Expand All @@ -116,8 +116,8 @@ public void testAuthenticatedRememberMe() {
// For the initial authentication, the mechanism should be called again

assertTrue(
"Authentication mechanism should have been called, but wasn't",
response.contains("authentication mechanism called: true"));
response.contains("authentication mechanism called: true"),
"Authentication mechanism should have been called, but wasn't");


// 5. Request same page again within same http session, with remember me
Expand All @@ -132,8 +132,8 @@ public void testAuthenticatedRememberMe() {
// (the remember me interceptor takes care of this)

assertTrue(
"Authentication mechanism should not have been called, but was",
response.contains("authentication mechanism called: false"));
response.contains("authentication mechanism called: false"),
"Authentication mechanism should not have been called, but was");


// 6. "Expire" the session by removing all cookies except the
Expand All @@ -158,8 +158,8 @@ public void testAuthenticatedRememberMe() {
// (the remember me interceptor takes care of this)

assertTrue(
"Authentication mechanism should not have been called, but was",
response.contains("authentication mechanism called: false"));
response.contains("authentication mechanism called: false"),
"Authentication mechanism should not have been called, but was");


// 7. Logout. Should not be authenticated anymore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
import static ee.jakarta.tck.security.test.Assert.assertDefaultAuthenticated;
import static ee.jakarta.tck.security.test.Assert.assertDefaultNotAuthenticated;
import static ee.jakarta.tck.security.test.ShrinkWrap.mavenWar;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import org.htmlunit.util.Cookie;


@RunWith(Arquillian.class)
@ExtendWith(ArquillianExtension.class)
public class AppCustomRememberMeIT extends ArquillianBase {

@Deployment(testable = false)
Expand Down Expand Up @@ -97,8 +97,8 @@ public void testAuthenticatedRememberMe() {
// For the initial authentication, the mechanism should be called

assertTrue(
"Authentication mechanism should have been called, but wasn't",
response.contains("authentication mechanism called: true"));
response.contains("authentication mechanism called: true"),
"Authentication mechanism should have been called, but wasn't");


// 3. Request same page again within same http session, without remember me
Expand All @@ -120,8 +120,8 @@ public void testAuthenticatedRememberMe() {
// For the initial authentication, the mechanism should be called again

assertTrue(
"Authentication mechanism should have been called, but wasn't",
response.contains("authentication mechanism called: true"));
response.contains("authentication mechanism called: true"),
"Authentication mechanism should have been called, but wasn't");


// 5. Request same page again within same http session, with remember me
Expand All @@ -136,8 +136,8 @@ public void testAuthenticatedRememberMe() {
// (the remember me interceptor takes care of this)

assertTrue(
"Authentication mechanism should not have been called, but was",
response.contains("authentication mechanism called: false"));
response.contains("authentication mechanism called: false"),
"Authentication mechanism should not have been called, but was");


// 6. "Expire" the session by removing all cookies except the
Expand All @@ -162,8 +162,8 @@ public void testAuthenticatedRememberMe() {
// (the remember me interceptor takes care of this)

assertTrue(
"Authentication mechanism should not have been called, but was",
response.contains("authentication mechanism called: false"));
response.contains("authentication mechanism called: false"),
"Authentication mechanism should not have been called, but was");


// 7. Logout. Should not be authenticated anymore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
import static ee.jakarta.tck.security.test.Assert.assertDefaultAuthenticated;
import static ee.jakarta.tck.security.test.Assert.assertDefaultNotAuthenticated;
import static ee.jakarta.tck.security.test.ShrinkWrap.mavenWar;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import ee.jakarta.tck.security.test.alternatives.TestAuthenticationMechanismSecureOnly;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.shrinkwrap.api.Archive;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;


@RunWith(Arquillian.class)
@ExtendWith(ArquillianExtension.class)
public class AppCustomRememberMeSecureOnlyIT extends ArquillianBase {

@Deployment(testable = false)
Expand Down
Loading