Using LoginContext in a servlet


General J2EE: Using LoginContext in a servlet

  1. Using LoginContext in a servlet (1 messages)

    Hi Friends,

    I want to use LoginContext in the servlet as follows:

    LoginContext ctx = new LoginContext("system", new MyCallbackHandler("root", "pramati"));

    Well, I can logon very successfully without any LoginException thrown. The problem is, after this servlet is executed, I try to access any resource which is secured (added to security-constraints in web.xml), the container redirects me to Login.jsp, considering that the login is not yet done.

    In short, I want to programmatically logon rather than using j_security_check.

    Thanks in Advance

    Muhammed Shakir
  2. I've been researching this myself, could you send me some code?