Skip to content

Commit c5219e3

Browse files
committed
Update config tests
1 parent 4dc75bf commit c5219e3

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.
@@ -270,7 +270,7 @@ public void saml2LogoutRequestWhenCustomSecurityContextHolderStrategyThenUses()
270270
}
271271

272272
@Test
273-
public void saml2LogoutRequestWhenNoRegistrationThen400() throws Exception {
273+
public void saml2LogoutRequestWhenNoRegistrationThen401() throws Exception {
274274
this.spring.configLocations(this.xml("Default")).autowire();
275275
DefaultSaml2AuthenticatedPrincipal principal = new DefaultSaml2AuthenticatedPrincipal("user",
276276
Collections.emptyMap());
@@ -283,18 +283,18 @@ public void saml2LogoutRequestWhenNoRegistrationThen400() throws Exception {
283283
.param("SigAlg", this.apLogoutRequestSigAlg)
284284
.param("Signature", this.apLogoutRequestSignature)
285285
.with(authentication(user)))
286-
.andExpect(status().isBadRequest());
286+
.andExpect(status().isUnauthorized());
287287
}
288288

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

300300
@Test

0 commit comments

Comments
 (0)