use of org.springframework.test.web.servlet.RequestBuilder in project gs-spring-security-3.2 by rwinch.
the class SecurityTests method robCannotAccessLukesMessage.
@Test
public void robCannotAccessLukesMessage() throws Exception {
RequestBuilder request = get("/110").with(user(rob).roles("USER"));
mvc.perform(request).andExpect(status().isForbidden());
}
use of org.springframework.test.web.servlet.RequestBuilder in project gs-spring-security-3.2 by rwinch.
the class SecurityTests method robCanAccessOwnMessage.
@Test
public void robCanAccessOwnMessage() throws Exception {
RequestBuilder request = get("/100").with(user(rob).roles("USER"));
mvc.perform(request).andExpect(status().isOk());
}
use of org.springframework.test.web.servlet.RequestBuilder in project gs-spring-security-3.2 by rwinch.
the class SecurityTests method composeRequiresCsrf.
@Test
public void composeRequiresCsrf() throws Exception {
RequestBuilder request = post("/").with(user(rob).roles("USER"));
mvc.perform(request).andExpect(invalidCsrf());
}
use of org.springframework.test.web.servlet.RequestBuilder in project gs-spring-security-3.2 by rwinch.
the class SecurityTests method invalidUsernamePassword.
@Test
public void invalidUsernamePassword() throws Exception {
RequestBuilder request = post("/login").param("username", "rob@example.com").param("password", "invalid").with(csrf());
mvc.perform(request).andExpect(invalidLogin());
}
Aggregations