ratcashdev / authenticroast

Automatically exported from code.google.com/p/authenticroast
1 stars 0 forks source link

TomcatAuthenticator: implement Servlet 3.0 login() and logout() methods for Tomcat 7 #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Following need to be added to TomcatAuthenticator.

    // This is an @Override for Tomcat 7, but not for Tomcat 6.
    public void login(String username, String password, Request request)
    {
        // Until I figure out the implementation if any.
        // Not sure that it really makes sense to support this in
        // a JAAS environment.
        throw new UnsupportedOperationException("login");
    }

    // This is an @Override for Tomcat 7, but not for Tomcat 6.
    public void logout(Request request)
    {
        // Just clear the remote user.
        request.setUserPrincipal(null);
        request.setAuthType(null);
            Session session = request.getSessionInternal(false);
        session.setPrincipal(null);
        session.removeNote(Constants.SESS_USERNAME_NOTE);
        session.removeNote(Constants.SESS_PASSWORD_NOTE);
    }

Original issue reported on code.google.com by EsmondP...@gmail.com on 15 Aug 2012 at 4:48

GoogleCodeExporter commented 9 years ago
Oops!

    // This is an @Override for Tomcat 7, but not for Tomcat 6.
    public void logout(Request request)
    {
        // Just clear the remote user.
        request.setUserPrincipal(null);
        request.setAuthType(null);
        Session session = request.getSessionInternal(false);
        if (session != null)
        {
            session.setPrincipal(null);
            session.removeNote(Constants.SESS_USERNAME_NOTE);
            session.removeNote(Constants.SESS_PASSWORD_NOTE);
        }
    }

Original comment by EsmondP...@gmail.com on 15 Aug 2012 at 4:55