Default Log Out Page

Fixes: gh-5516
This commit is contained in:
Rob Winch
2018-07-13 14:33:06 -05:00
parent 05ed028f9d
commit a3210c96d9
17 changed files with 3917 additions and 12 deletions

View File

@@ -50,7 +50,7 @@ public class XsdDocumentedTests {
String referenceLocation = "../docs/manual/src/docs/asciidoc/_includes/appendix/namespace.adoc";
String schema31xDocumentLocation = "org/springframework/security/config/spring-security-3.1.xsd";
String schemaDocumentLocation = "org/springframework/security/config/spring-security-5.0.xsd";
String schemaDocumentLocation = "org/springframework/security/config/spring-security-5.1.xsd";
XmlSupport xml = new XmlSupport();
@@ -142,7 +142,7 @@ public class XsdDocumentedTests {
String[] schemas = resource.getFile().getParentFile().list((dir, name) -> name.endsWith(".xsd"));
assertThat(schemas.length).isEqualTo(12)
assertThat(schemas.length).isEqualTo(13)
.withFailMessage("the count is equal to 12, if not then schemaDocument needs updating");
}

View File

@@ -528,7 +528,8 @@ public class CsrfConfigTests {
this.xml("CsrfEnabled")
).autowire();
this.mvc.perform(get("/logout")).andExpect(status().isNotFound());
this.mvc.perform(get("/logout"))
.andExpect(status().isOk()); // renders form to log out but does not perform a redirect
// still logged in
this.mvc.perform(get("/authenticated")).andExpect(status().isOk());

View File

@@ -22,6 +22,7 @@ import org.springframework.security.config.test.SpringTestRule;
import org.springframework.security.web.WebAttributes;
import org.springframework.test.web.servlet.MockMvc;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.core.IsNull.nullValue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -84,6 +85,16 @@ public class FormLoginBeanDefinitionParserTests {
this.mvc.perform(get("/login")).andExpect(content().string(expectedContent));
}
@Test
public void getLogoutWhenAutoConfigThenShowsDefaultLogoutPage()
throws Exception {
this.spring.configLocations(this.xml("AutoConfig")).autowire();
this.mvc.perform(get("/logout"))
.andExpect(content().string(containsString("action=\"/logout\"")));
}
@Test
public void getLoginWhenConfiguredWithCustomAttributesThenLoginPageReflects()
throws Exception {
@@ -118,6 +129,8 @@ public class FormLoginBeanDefinitionParserTests {
+ "</body></html>";
this.mvc.perform(get("/login")).andExpect(content().string(expectedContent));
this.mvc.perform(get("/logout")).andExpect(status().is3xxRedirection());
}
@Test