users@glassfish.java.net

Setting Principal In Custom Login Module

From: <glassfish_at_javadesktop.org>
Date: Sun, 04 Jul 2010 18:33:35 PDT

Hi All,

I'm attempting to write a custom login module which extends javax.security.auth.spi.LoginModule

My module currently authenticates the user successfully, but the commit method which sets the principal does not appear to be working. To keep it simple, the method has the following body:

Principal p = new MyCustomPrincipal("testuser");
subject.getPrincipals().add(p);
return true;

Commit is definitely being called, but my calls to request.getUserPrincipal() or request.getRemoteUser(), from a servlet are returning null.

I've also tried setting the principal within my server auth module (ServerAuthModule), but I get the same result.

Is there some other step or requirement I'm missing to set a custom principal when using a custom login module for glassfish (2.1.1)?

Thanks
[Message sent by forum member 'unistd_h']

http://forums.java.net/jive/thread.jspa?messageID=476754