Search in sources :

Example 1 with JwtAuthenticationRequest

use of fr.codechill.spring.security.JwtAuthenticationRequest in project code-chill by CodeChillAlluna.

the class AuthenticationRestControllerTest method successfulAuthenticationWithAnonymousUser.

@Test
@WithAnonymousUser
public void successfulAuthenticationWithAnonymousUser() throws Exception {
    JwtAuthenticationRequest jwtAuthenticationRequest = new JwtAuthenticationRequest("user", "password");
    this.mvc.perform(post("/auth").contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(jwtAuthenticationRequest))).andExpect(status().is2xxSuccessful());
}
Also used : JwtAuthenticationRequest(fr.codechill.spring.security.JwtAuthenticationRequest) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) WithAnonymousUser(org.springframework.security.test.context.support.WithAnonymousUser) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JwtAuthenticationRequest (fr.codechill.spring.security.JwtAuthenticationRequest)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 WithAnonymousUser (org.springframework.security.test.context.support.WithAnonymousUser)1