I have my rest web services secured with Spring Security. I'm returning the the appropriate responses (401 for failure, 200 for success, etc) via the various handlers. The client does not want to store the credentials on the device, so I cannot do true restful per-request authentication by passing the creds in the header of each request. So, I'm trying to set up the Persistant Token Approach with Remember-me.
I have the db table all set up and am able to login. The login creates the a row in the persistent_logins table of my database containing the series & token values.
My issue is twofold:
- What do I need to add in my successHandler class that returns the 200 response to the user to also return the token ( do I need the series value as well? )?
- When testing via curl, how do I set this token in the header?
Here's my successHandler class:
public class RestAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler{
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws ServletException, IOException {
response.setStatus(HttpServletResponse.SC_OK);
clearAuthenticationAttributes(request);
}
}
Thanks in advance for any and all help!