@GetMapping("/authenticate")
    public ResponseEntity<UsernamePasswordAuthenticationToken> getAuthentication(@RequestParam String token) {
        UsernamePasswordAuthenticationToken authentication = tokenService.getAuthentication(token);
        return ResponseEntity.ok(authentication);
    }
@Test
    void givenValidToken_whenGetAuthentication_thenReturnAuthentication() throws Exception {

        // Given
        String validToken = "validToken";
        UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken("user", "password");

        // When
        when(tokenService.getAuthentication(validToken)).thenReturn(authenticationToken);

        // Then
        mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/users/authenticate")
                        .param("token", validToken))
                .andDo(MockMvcResultHandlers.print())
                .andExpect(MockMvcResultMatchers.status().isOk())
                .andExpect(MockMvcResultMatchers.jsonPath("$.principal").value("user"))
                .andExpect(MockMvcResultMatchers.jsonPath("$.credentials").value("password"));

        // Verify
        verify(tokenService, times(1)).getAuthentication(validToken);

    }