Implementing User Authentication with Tomcat

Hey, I'm using Tomcat 6.0.14 and would like to know to implement a system that would allow us to send users a link: mysite.com?token=12345678912334333 (a long line continued), but this would allow the user to automatically register.

+3
source share
2 answers

If you do not have other reasons specific to Tomcat, or you cannot change your web application, then it would be easier to use a custom filter for authentication (JAAS or otherwise). For instance:

, .

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain) 
  throws IOException, ServletException {

    String token = request.getParameter("token");
    if (token != null) {
      doAuthentication(token);
    }

    chain.doFilter(request, wrapper);
}

JAAS. , , , Tomcat JAASRealm? LoginModule .

, , E-mail .

+3

, , - , , , .

,

0

Source: https://habr.com/ru/post/1788591/


All Articles