From ef0da864e77a5195e3196f4233dd398af901b021 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Tue, 29 Oct 2024 15:40:40 +0100 Subject: [PATCH 01/14] Initial commit From bb5308f363f3f27bb7ad0f8ef5b8aea42d925be6 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 09:40:50 +0100 Subject: [PATCH 02/14] Ignore the test class from where the tests has started failing. --- .../dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index 343f0c5fe035..5bf6a66ddb45 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -44,6 +44,7 @@ import org.dspace.services.ConfigurationService; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -52,6 +53,7 @@ * * @author Milan Majchrak (milan.majchrak at dataquest.sk). */ +@Ignore public class ClarinShibbolethLoginFilterIT extends AbstractControllerIntegrationTest { public static final String[] SHIB_ONLY = {"org.dspace.authenticate.clarin.ClarinShibAuthentication"}; From fc27ab2f4708a9d0989d4e0b339413fd3edfb9e1 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 12:58:50 +0100 Subject: [PATCH 03/14] Ignored half of tests in the ClarinShibbolethLoginFilterIT file --- .../rest/security/ClarinShibbolethLoginFilterIT.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index 5bf6a66ddb45..c4d5f1a2331d 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -53,7 +53,6 @@ * * @author Milan Majchrak (milan.majchrak at dataquest.sk). */ -@Ignore public class ClarinShibbolethLoginFilterIT extends AbstractControllerIntegrationTest { public static final String[] SHIB_ONLY = {"org.dspace.authenticate.clarin.ClarinShibAuthentication"}; @@ -437,6 +436,7 @@ public void testRedirectRequiresShibAttributes() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testRedirectToAnotherGivenTrustedUrl() throws Exception { getClient().perform(get("/api/authn/shibboleth") @@ -448,6 +448,7 @@ public void testRedirectToAnotherGivenTrustedUrl() throws Exception { .andExpect(redirectedUrl("http://anotherdspacehost:4000/home")); } + @Ignore // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. @Test public void testRedirectToGivenUntrustedUrl() throws Exception { @@ -462,6 +463,7 @@ public void testRedirectToGivenUntrustedUrl() throws Exception { .andExpect(status().isBadRequest()); } + @Ignore @Test public void testISOShibHeaders() throws Exception { String testMail = "test@email.edu"; @@ -486,6 +488,7 @@ public void testISOShibHeaders() throws Exception { deleteShibbolethUser(ePerson); } + @Ignore @Test public void testUTF8ShibHeaders() throws Exception { String testMail = "test@email.edu"; @@ -510,6 +513,7 @@ public void testUTF8ShibHeaders() throws Exception { deleteShibbolethUser(ePerson); } + @Ignore @Test public void testRedirectToMissingHeadersWithRedirectUrlParam() throws Exception { String expectedMissingHeadersUrl = configurationService.getProperty("dspace.ui.url") + "/login/missing-headers"; @@ -523,6 +527,7 @@ public void testRedirectToMissingHeadersWithRedirectUrlParam() throws Exception } // eppn is set + @Ignore @Test public void testSuccessFullLoginEppnNetId() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") @@ -540,6 +545,7 @@ public void testSuccessFullLoginEppnNetId() throws Exception { } // persistent-id is set + @Ignore @Test public void testSuccessFullLoginPersistentIdNetId() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") @@ -555,6 +561,7 @@ public void testSuccessFullLoginPersistentIdNetId() throws Exception { deleteShibbolethUser(ePerson); } + @Ignore @Test public void testSuccessFullLoginWithTwoEmails() throws Exception { String firstEmail = "efg@test.edu"; @@ -573,6 +580,7 @@ public void testSuccessFullLoginWithTwoEmails() throws Exception { } // The user has changed the email. But that email is already used by another user. + @Ignore @Test public void testDuplicateEmailError() throws Exception { String userWithEppnEmail = "user@eppn.sk"; From e9e6988171528fc0dfca78eddd6530d09fabbd1c Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 13:43:52 +0100 Subject: [PATCH 04/14] Ignored all tests --- .../security/ClarinShibbolethLoginFilterIT.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index c4d5f1a2331d..1e95e959a508 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -116,6 +116,7 @@ public void destroy() throws Exception { /** * Test the IdP hasn't sent the `Shib-Identity-Provider` or `SHIB-NETID` header. */ + @Ignore @Test public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() throws Exception { String idp = "Test Idp"; @@ -134,6 +135,7 @@ public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() thro * The user is redirected to the page when he must fill his email. */ // HERE + @Ignore @Test public void shouldReturnUserWithoutEmailException() throws Exception { // Create a new netId because the user shouldn't exist @@ -158,6 +160,7 @@ public void shouldReturnUserWithoutEmailException() throws Exception { * 4. If the user is registered he is automatically signed in by the NETID which is passed from the IdP. * @throws Exception */ + @Ignore @Test public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exception { String email = "test@mail.epic"; @@ -214,6 +217,7 @@ public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exc deleteShibbolethUser(ePerson); } + @Ignore @Test public void testShouldReturnDuplicateUserError() throws Exception { String email = "test@mail.epic"; @@ -253,6 +257,7 @@ public void testShouldReturnDuplicateUserError() throws Exception { } // Login with email without netid, but the user with such email already exists and it has assigned netid. + @Ignore @Test public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Exception { String email = "test@email.sk"; @@ -280,6 +285,7 @@ public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Excepti } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testRedirectToGivenTrustedUrl() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") @@ -305,6 +311,7 @@ public void testRedirectToGivenTrustedUrl() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void patchPassword() throws Exception { String newPassword = "newpassword"; @@ -334,6 +341,7 @@ public void patchPassword() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testRedirectToDefaultDspaceUrl() throws Exception { // NOTE: The initial call to /shibboleth comes *from* an external Shibboleth site. So, it is always @@ -362,6 +370,7 @@ public void testRedirectToDefaultDspaceUrl() throws Exception { } // This test is copied from the `AuthenticationRestControllerIT` and modified following the Clarin updates. + @Ignore @Test public void testShibbolethEndpointCannotBeUsedWithShibDisabled() throws Exception { // Enable only password login @@ -395,6 +404,7 @@ public void testShibbolethEndpointCannotBeUsedWithShibDisabled() throws Exceptio } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testNoRedirectIfInvalidShibAttributes() throws Exception { // In this request, we use a SHIB-MAIL attribute which does NOT match an EPerson. @@ -404,6 +414,7 @@ public void testNoRedirectIfInvalidShibAttributes() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testNoRedirectIfShibbolethDisabled() throws Exception { // Enable Password authentication ONLY @@ -418,6 +429,7 @@ public void testNoRedirectIfShibbolethDisabled() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testRedirectRequiresShibAttributes2() throws Exception { String token = getAuthToken(eperson.getEmail(), password); @@ -428,6 +440,7 @@ public void testRedirectRequiresShibAttributes2() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testRedirectRequiresShibAttributes() throws Exception { // Verify this endpoint doesn't work if no SHIB-* attributes are set From 293a6218aae5797368b64a26af1c65bbc1088fe7 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 14:14:16 +0100 Subject: [PATCH 05/14] Ade --- .../app/rest/security/ClarinShibbolethLoginFilterIT.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index 1e95e959a508..e36563a7240d 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -117,7 +117,6 @@ public void destroy() throws Exception { * Test the IdP hasn't sent the `Shib-Identity-Provider` or `SHIB-NETID` header. */ @Ignore - @Test public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() throws Exception { String idp = "Test Idp"; @@ -136,7 +135,6 @@ public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() thro */ // HERE @Ignore - @Test public void shouldReturnUserWithoutEmailException() throws Exception { // Create a new netId because the user shouldn't exist String netId = NET_ID_TEST_EPERSON + 986; @@ -161,7 +159,6 @@ public void shouldReturnUserWithoutEmailException() throws Exception { * @throws Exception */ @Ignore - @Test public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exception { String email = "test@mail.epic"; String netId = email; @@ -218,7 +215,6 @@ public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exc } @Ignore - @Test public void testShouldReturnDuplicateUserError() throws Exception { String email = "test@mail.epic"; String netId = email; @@ -258,7 +254,6 @@ public void testShouldReturnDuplicateUserError() throws Exception { // Login with email without netid, but the user with such email already exists and it has assigned netid. @Ignore - @Test public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Exception { String email = "test@email.sk"; String netId = email; @@ -286,7 +281,6 @@ public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Excepti // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. @Ignore - @Test public void testRedirectToGivenTrustedUrl() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") .param("redirectUrl", "http://localhost:8080/server/api/authn/status") From 055de657b287e266fe519b29733ea20b09cc98ae Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 14:51:13 +0100 Subject: [PATCH 06/14] unignore some tests --- .../rest/security/ClarinShibbolethLoginFilterIT.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index e36563a7240d..cf407ee37b98 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -116,7 +116,7 @@ public void destroy() throws Exception { /** * Test the IdP hasn't sent the `Shib-Identity-Provider` or `SHIB-NETID` header. */ - @Ignore + @Test public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() throws Exception { String idp = "Test Idp"; @@ -134,7 +134,7 @@ public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() thro * The user is redirected to the page when he must fill his email. */ // HERE - @Ignore + @Test public void shouldReturnUserWithoutEmailException() throws Exception { // Create a new netId because the user shouldn't exist String netId = NET_ID_TEST_EPERSON + 986; @@ -158,7 +158,7 @@ public void shouldReturnUserWithoutEmailException() throws Exception { * 4. If the user is registered he is automatically signed in by the NETID which is passed from the IdP. * @throws Exception */ - @Ignore + @Test public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exception { String email = "test@mail.epic"; String netId = email; @@ -214,7 +214,7 @@ public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exc deleteShibbolethUser(ePerson); } - @Ignore + @Test public void testShouldReturnDuplicateUserError() throws Exception { String email = "test@mail.epic"; String netId = email; @@ -253,7 +253,7 @@ public void testShouldReturnDuplicateUserError() throws Exception { } // Login with email without netid, but the user with such email already exists and it has assigned netid. - @Ignore + @Test public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Exception { String email = "test@email.sk"; String netId = email; @@ -280,7 +280,7 @@ public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Excepti } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore + @Test public void testRedirectToGivenTrustedUrl() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") .param("redirectUrl", "http://localhost:8080/server/api/authn/status") From 0b9c0ca718b1e70b46444800a742f1196bfb9fa1 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 15:25:12 +0100 Subject: [PATCH 07/14] 3 tests ignored 3 allowed --- .../app/rest/security/ClarinShibbolethLoginFilterIT.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index cf407ee37b98..5799cdab8bf1 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -214,6 +214,7 @@ public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exc deleteShibbolethUser(ePerson); } + @Ignore @Test public void testShouldReturnDuplicateUserError() throws Exception { String email = "test@mail.epic"; @@ -253,6 +254,7 @@ public void testShouldReturnDuplicateUserError() throws Exception { } // Login with email without netid, but the user with such email already exists and it has assigned netid. + @Ignore @Test public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Exception { String email = "test@email.sk"; @@ -280,6 +282,7 @@ public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Excepti } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testRedirectToGivenTrustedUrl() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") From 0de9b87ca60152e26f1673d34524f4f7bff1f2e9 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 15:56:14 +0100 Subject: [PATCH 08/14] Maybe the problematic test is hidden between 3 unignored tests --- .../app/rest/security/ClarinShibbolethLoginFilterIT.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index 5799cdab8bf1..8c33b28a98ba 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -116,6 +116,7 @@ public void destroy() throws Exception { /** * Test the IdP hasn't sent the `Shib-Identity-Provider` or `SHIB-NETID` header. */ + @Ignore @Test public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() throws Exception { String idp = "Test Idp"; @@ -134,6 +135,7 @@ public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() thro * The user is redirected to the page when he must fill his email. */ // HERE + @Ignore @Test public void shouldReturnUserWithoutEmailException() throws Exception { // Create a new netId because the user shouldn't exist @@ -158,6 +160,7 @@ public void shouldReturnUserWithoutEmailException() throws Exception { * 4. If the user is registered he is automatically signed in by the NETID which is passed from the IdP. * @throws Exception */ + @Ignore @Test public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exception { String email = "test@mail.epic"; @@ -214,7 +217,6 @@ public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exc deleteShibbolethUser(ePerson); } - @Ignore @Test public void testShouldReturnDuplicateUserError() throws Exception { String email = "test@mail.epic"; @@ -254,7 +256,6 @@ public void testShouldReturnDuplicateUserError() throws Exception { } // Login with email without netid, but the user with such email already exists and it has assigned netid. - @Ignore @Test public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Exception { String email = "test@email.sk"; @@ -282,7 +283,6 @@ public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Excepti } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void testRedirectToGivenTrustedUrl() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") From 933e0487402dbae285be7ae67709d3343372bc31 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 16:35:59 +0100 Subject: [PATCH 09/14] two candidates --- .../dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java | 1 + 1 file changed, 1 insertion(+) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index 8c33b28a98ba..afc1f54d9e92 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -217,6 +217,7 @@ public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exc deleteShibbolethUser(ePerson); } + @Ignore @Test public void testShouldReturnDuplicateUserError() throws Exception { String email = "test@mail.epic"; From 817aa747166f0d6f0990da08f4733f1d2dd9ea23 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 17:05:52 +0100 Subject: [PATCH 10/14] The last candidate --- .../dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java | 1 + 1 file changed, 1 insertion(+) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index afc1f54d9e92..eb8ae9daf1c7 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -284,6 +284,7 @@ public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Excepti } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. + @Ignore @Test public void testRedirectToGivenTrustedUrl() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") From 8357ca21ad7f51e9fd89ba6ecf9858bb96feca6d Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 30 Oct 2024 17:36:46 +0100 Subject: [PATCH 11/14] Ignore just wrong test and all test should pass --- .../ClarinShibbolethLoginFilterIT.java | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index eb8ae9daf1c7..04764fa41d57 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -116,7 +116,6 @@ public void destroy() throws Exception { /** * Test the IdP hasn't sent the `Shib-Identity-Provider` or `SHIB-NETID` header. */ - @Ignore @Test public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() throws Exception { String idp = "Test Idp"; @@ -135,7 +134,6 @@ public void shouldReturnMissingHeadersFromIdpExceptionBecauseOfMissingIdp() thro * The user is redirected to the page when he must fill his email. */ // HERE - @Ignore @Test public void shouldReturnUserWithoutEmailException() throws Exception { // Create a new netId because the user shouldn't exist @@ -160,7 +158,6 @@ public void shouldReturnUserWithoutEmailException() throws Exception { * 4. If the user is registered he is automatically signed in by the NETID which is passed from the IdP. * @throws Exception */ - @Ignore @Test public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exception { String email = "test@mail.epic"; @@ -217,7 +214,6 @@ public void userFillInEmailAndShouldBeRegisteredByVerificationToken() throws Exc deleteShibbolethUser(ePerson); } - @Ignore @Test public void testShouldReturnDuplicateUserError() throws Exception { String email = "test@mail.epic"; @@ -256,7 +252,9 @@ public void testShouldReturnDuplicateUserError() throws Exception { EPersonBuilder.deleteEPerson(ePerson.getID()); } + // THIS TEST IS WRONG! // Login with email without netid, but the user with such email already exists and it has assigned netid. + @Ignore @Test public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Exception { String email = "test@email.sk"; @@ -284,7 +282,6 @@ public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Excepti } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void testRedirectToGivenTrustedUrl() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") @@ -310,7 +307,6 @@ public void testRedirectToGivenTrustedUrl() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void patchPassword() throws Exception { String newPassword = "newpassword"; @@ -340,7 +336,6 @@ public void patchPassword() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void testRedirectToDefaultDspaceUrl() throws Exception { // NOTE: The initial call to /shibboleth comes *from* an external Shibboleth site. So, it is always @@ -369,7 +364,6 @@ public void testRedirectToDefaultDspaceUrl() throws Exception { } // This test is copied from the `AuthenticationRestControllerIT` and modified following the Clarin updates. - @Ignore @Test public void testShibbolethEndpointCannotBeUsedWithShibDisabled() throws Exception { // Enable only password login @@ -403,7 +397,6 @@ public void testShibbolethEndpointCannotBeUsedWithShibDisabled() throws Exceptio } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void testNoRedirectIfInvalidShibAttributes() throws Exception { // In this request, we use a SHIB-MAIL attribute which does NOT match an EPerson. @@ -413,7 +406,6 @@ public void testNoRedirectIfInvalidShibAttributes() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void testNoRedirectIfShibbolethDisabled() throws Exception { // Enable Password authentication ONLY @@ -428,7 +420,6 @@ public void testNoRedirectIfShibbolethDisabled() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void testRedirectRequiresShibAttributes2() throws Exception { String token = getAuthToken(eperson.getEmail(), password); @@ -439,7 +430,6 @@ public void testRedirectRequiresShibAttributes2() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void testRedirectRequiresShibAttributes() throws Exception { // Verify this endpoint doesn't work if no SHIB-* attributes are set @@ -448,7 +438,6 @@ public void testRedirectRequiresShibAttributes() throws Exception { } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. - @Ignore @Test public void testRedirectToAnotherGivenTrustedUrl() throws Exception { getClient().perform(get("/api/authn/shibboleth") @@ -460,7 +449,6 @@ public void testRedirectToAnotherGivenTrustedUrl() throws Exception { .andExpect(redirectedUrl("http://anotherdspacehost:4000/home")); } - @Ignore // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. @Test public void testRedirectToGivenUntrustedUrl() throws Exception { @@ -475,7 +463,6 @@ public void testRedirectToGivenUntrustedUrl() throws Exception { .andExpect(status().isBadRequest()); } - @Ignore @Test public void testISOShibHeaders() throws Exception { String testMail = "test@email.edu"; @@ -500,7 +487,6 @@ public void testISOShibHeaders() throws Exception { deleteShibbolethUser(ePerson); } - @Ignore @Test public void testUTF8ShibHeaders() throws Exception { String testMail = "test@email.edu"; @@ -525,7 +511,6 @@ public void testUTF8ShibHeaders() throws Exception { deleteShibbolethUser(ePerson); } - @Ignore @Test public void testRedirectToMissingHeadersWithRedirectUrlParam() throws Exception { String expectedMissingHeadersUrl = configurationService.getProperty("dspace.ui.url") + "/login/missing-headers"; @@ -539,7 +524,6 @@ public void testRedirectToMissingHeadersWithRedirectUrlParam() throws Exception } // eppn is set - @Ignore @Test public void testSuccessFullLoginEppnNetId() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") @@ -557,7 +541,6 @@ public void testSuccessFullLoginEppnNetId() throws Exception { } // persistent-id is set - @Ignore @Test public void testSuccessFullLoginPersistentIdNetId() throws Exception { String token = getClient().perform(get("/api/authn/shibboleth") @@ -573,7 +556,6 @@ public void testSuccessFullLoginPersistentIdNetId() throws Exception { deleteShibbolethUser(ePerson); } - @Ignore @Test public void testSuccessFullLoginWithTwoEmails() throws Exception { String firstEmail = "efg@test.edu"; @@ -592,7 +574,6 @@ public void testSuccessFullLoginWithTwoEmails() throws Exception { } // The user has changed the email. But that email is already used by another user. - @Ignore @Test public void testDuplicateEmailError() throws Exception { String userWithEppnEmail = "user@eppn.sk"; From 41287533f9d2137e78e75b246f7c1042aedc5230 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 31 Oct 2024 08:35:36 +0100 Subject: [PATCH 12/14] Clean up object created in the test. --- .../app/rest/security/ClarinShibbolethLoginFilterIT.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index 04764fa41d57..6439e250db2b 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -252,9 +252,7 @@ public void testShouldReturnDuplicateUserError() throws Exception { EPersonBuilder.deleteEPerson(ePerson.getID()); } - // THIS TEST IS WRONG! // Login with email without netid, but the user with such email already exists and it has assigned netid. - @Ignore @Test public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Exception { String email = "test@email.sk"; @@ -279,6 +277,9 @@ public void testShouldReturnDuplicateUserErrorLoginWithoutNetId() throws Excepti .andExpect(redirectedUrl("http://localhost:4000/login/duplicate-user?email=" + email)) .andReturn().getResponse().getHeader("Authorization"); + // Check if was created a user with such email and netid. + EPerson ePerson = checkUserWasCreated(netId, IDP_TEST_EPERSON, email, null); + deleteShibbolethUser(ePerson); } // This test is copied from the `ShibbolethLoginFilterIT` and modified following the Clarin updates. From dba9f70365d912678aee548ed729a6712c9cdae6 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 31 Oct 2024 09:09:47 +0100 Subject: [PATCH 13/14] Removed unused import. --- .../dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java | 1 - 1 file changed, 1 deletion(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index 6439e250db2b..09d808d2e62d 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -44,7 +44,6 @@ import org.dspace.services.ConfigurationService; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; From f5118c686f57300aa6545fe38f2bb908fa0cb718 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 31 Oct 2024 10:08:14 +0100 Subject: [PATCH 14/14] Check the user which is going to be deleted is not null. --- .../dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java | 1 + 1 file changed, 1 insertion(+) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java index 09d808d2e62d..6cf8c6058d7a 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/security/ClarinShibbolethLoginFilterIT.java @@ -570,6 +570,7 @@ public void testSuccessFullLoginWithTwoEmails() throws Exception { checkUserIsSignedIn(token); // Find the user by the second email EPerson ePerson = checkUserWasCreated(null, IDP_TEST_EPERSON, secondEmail, null); + assertTrue(Objects.nonNull(ePerson)); deleteShibbolethUser(ePerson); }