문제

I've implemented a LoginModule to perform some custom authentication, and call the authentication using the login() method of the LoginContext class. The login module's login() and commit() methods are called successfully, but instead of being able to use the web app I am being sent back to the login page immediately. request.getUserPrincipal() is null, as well as request.getRemoteUser().

Any ideas would be greatly appreciated. Thanks!

ADDITIONAL INFO

Also, right after I call loginContext.login() on the front end, calling loginContext.getSubject().getPrincipals() gives me the proper list of principals and roles for the user that just logged in.

I'm using Tomcat 6.0.29 as my server.

도움이 되었습니까?

해결책 2

I was trying to do programmatic login in Tomcat, and even though the login module was running, the container wasn't receiving the authentication. My solution was to do authentication using an HTML form with "j_security_check" as it's action.

다른 팁

umm a shot in the dark

have you tried giving permission in the policy file like so

grant codeBase "file:/myCustomModule.jar" {
  permission javax.security.auth.AuthPermission "modifyPrincipals";
  permission javax.security.auth.AuthPermission "modifyPublicCredentials";
  permission javax.security.auth.AuthPermission "modifyPrivateCredentials";
};
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top