samedi 4 avril 2015

Spring security authentication via URL: handle bad token

I'm using Spring Security's ability to auto login by unauthenticated request, when it looks at request url and determines whether user is using correct token or no, then do auto login on success and show message on failure:



public class LinkRememberMeService implements RememberMeServices, LogoutHandler
{
@Autowired
private UserAccountProvider userAccountProvider;

@Override
public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response)
{
//if ok - return authentication object
//if not ok - retun null then spring redirects to default intercept-url
}
.....
}


Instead of returning a null on wrong access token, i'd like to render error message template with thymeleaf. What would be the best way to handle that?


Aucun commentaire:

Enregistrer un commentaire