aspose file tools
The moose likes Security and the fly likes login manually using LoginContext is not stored on the session for a security constraint Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » Security
Reply Bookmark "login manually using LoginContext is not stored on the session for a security constraint" Watch "login manually using LoginContext is not stored on the session for a security constraint" New topic
Author

login manually using LoginContext is not stored on the session for a security constraint

Elico Av
Greenhorn

Joined: Dec 19, 2010
Posts: 6
Hi,

I have a custom login module:




I have a jaas.login:
TomcatTest {
com.tomcat.test.security.CustomLoginModule required debug=true;
};

In my web.xml I have:
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>TomcatTest</realm-name>
</login-config>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>all</web-resource-name>
<url-pattern>/secured/*</url-pattern>
<http-method>HEAD</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>DELETE</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>

When I go to a URL /secured/secured.html I get the login popup and everything works well.

I tried to implement a different servlet (not secured) and perform a manual login:


And I also created the CustomCallbackHandler:


In the LoginServlet the login is successfull, but when from the same browser I go to /secured/secured.html I still get the login popup from the browser.
It seems that the session does not 'remember' the manual login.

Can someone please tell me what I am doing wrong? I don't know what else to do

Thank you very much for your assistance.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: login manually using LoginContext is not stored on the session for a security constraint
 
Similar Threads
EJB Security: Not getting correct name in Principal
JAAS with JSF misunderstanding
Jboss login module issue, HTTP Status 403
Tomcat JAAS Authentication NullPointerException
JBoss 5.1.0 GA. FORM based authentication