So I used answer for this question as my tutorial for token based authentication. But I still have a problem with setting up authorization header.
In my authenticateUser method I tried to set up a bearer header, here's th code
@POST
@Path("/users/authentication")
@Produces("application/json")
@Consumes("application/x-www-form-urlencoded")
public Response getUsers(@FormParam("username") String username,
        @FormParam("password") String password){    
    try{
        if(userDao.existUser(username, password)){
            User uUser = new User(userDao.getUser(username, password));
            uUser.setToken(userDao.issueToken());
            uUser.setTokenExpDate();
            userDao.updateUser(uUser);
            Response response = Response.ok(userDao.getUser(uUser.getId()).getToken())
                    .header(HttpHeaders.AUTHORIZATION, "Bearer "+userDao.getUser(uUser.getId()).getToken())
                    .build();
            System.out.println(response.getHeaderString(HttpHeaders.AUTHORIZATION));
            return response;                
            }
        }catch(Exception e){
            return Response.status(Response.Status.UNAUTHORIZED).build();
        }
    return null;
}
As you can see I'm setting it on response variable and it's there. But once I go to secured method and my AuthenticationFilter activates I find out that the header that i get from requestContext is null. How do I sent token to this header properly in this situation? Here's my full code
 
     
    