Skip to content

Commit 358f6c9

Browse files
1livvjzheaux
authored andcommitted
Update config tests
Signed-off-by: Liviu Gheorghe <[email protected]>
1 parent eaf8184 commit 358f6c9

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

config/src/test/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LogoutConfigurerTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -371,7 +371,7 @@ public void saml2LogoutRequestWhenLowercaseEncodingAndDifferentQueryParamOrderTh
371371
}
372372

373373
@Test
374-
public void saml2LogoutRequestWhenNoRegistrationThen400() throws Exception {
374+
public void saml2LogoutRequestWhenNoRegistrationThen401() throws Exception {
375375
this.spring.register(Saml2LogoutDefaultsConfig.class).autowire();
376376
DefaultSaml2AuthenticatedPrincipal principal = new DefaultSaml2AuthenticatedPrincipal("user",
377377
Collections.emptyMap());
@@ -384,19 +384,19 @@ public void saml2LogoutRequestWhenNoRegistrationThen400() throws Exception {
384384
.param("SigAlg", this.apLogoutRequestSigAlg)
385385
.param("Signature", this.apLogoutRequestSignature)
386386
.with(authentication(user)))
387-
.andExpect(status().isBadRequest());
387+
.andExpect(status().isUnauthorized());
388388
verifyNoInteractions(getBean(LogoutHandler.class));
389389
}
390390

391391
@Test
392-
public void saml2LogoutRequestWhenInvalidSamlRequestThen401() throws Exception {
392+
public void saml2LogoutRequestWhenInvalidSamlRequestThen302Redirect() throws Exception {
393393
this.spring.register(Saml2LogoutDefaultsConfig.class).autowire();
394394
this.mvc
395395
.perform(get("/logout/saml2/slo").param("SAMLRequest", this.apLogoutRequest)
396396
.param("RelayState", this.apLogoutRequestRelayState)
397397
.param("SigAlg", this.apLogoutRequestSigAlg)
398398
.with(authentication(this.user)))
399-
.andExpect(status().isUnauthorized());
399+
.andExpect(status().isFound());
400400
verifyNoInteractions(getBean(LogoutHandler.class));
401401
}
402402

config/src/test/java/org/springframework/security/config/http/Saml2LogoutBeanDefinitionParserTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -271,7 +271,7 @@ public void saml2LogoutRequestWhenCustomSecurityContextHolderStrategyThenUses()
271271
}
272272

273273
@Test
274-
public void saml2LogoutRequestWhenNoRegistrationThen400() throws Exception {
274+
public void saml2LogoutRequestWhenNoRegistrationThen401() throws Exception {
275275
this.spring.configLocations(this.xml("Default")).autowire();
276276
DefaultSaml2AuthenticatedPrincipal principal = new DefaultSaml2AuthenticatedPrincipal("user",
277277
Collections.emptyMap());
@@ -284,18 +284,18 @@ public void saml2LogoutRequestWhenNoRegistrationThen400() throws Exception {
284284
.param("SigAlg", this.apLogoutRequestSigAlg)
285285
.param("Signature", this.apLogoutRequestSignature)
286286
.with(authentication(user)))
287-
.andExpect(status().isBadRequest());
287+
.andExpect(status().isUnauthorized());
288288
}
289289

290290
@Test
291-
public void saml2LogoutRequestWhenInvalidSamlRequestThen401() throws Exception {
291+
public void saml2LogoutRequestWhenInvalidSamlRequestThen302Redirect() throws Exception {
292292
this.spring.configLocations(this.xml("Default")).autowire();
293293
this.mvc
294294
.perform(get("/logout/saml2/slo").param("SAMLRequest", this.apLogoutRequest)
295295
.param("RelayState", this.apLogoutRequestRelayState)
296296
.param("SigAlg", this.apLogoutRequestSigAlg)
297297
.with(authentication(this.saml2User)))
298-
.andExpect(status().isUnauthorized());
298+
.andExpect(status().isFound());
299299
}
300300

301301
@Test

0 commit comments

Comments
 (0)