[jboss-user] [Security & JAAS/JBoss] - Re: JAAS problem with LoginModule
Wolfgang Knauf
do-not-reply at jboss.com
Thu Feb 5 09:47:30 EST 2009
Hi,
please provide full code of your login module (e.g. the base class).
I built a custom login module once, and it looked like this:
public class MyLoginModule extends UsernamePasswordLoginModule
| {
|
| public void initialize(Subject subject, CallbackHandler callbackHandler,
| Map sharedState, Map options)
| {
| super.initialize(subject, callbackHandler, sharedState, options);
|
| ...initialize module according to config from "options"....
|
| }
|
| /**Get roles of current user
| * @return An Array of user roles roles
| */
| protected Group[] getRoleSets() throws LoginException
| {
| Group[] groups = { new SimpleGroup("Roles") };
|
| String user = super.getUsername();
|
| //Get roles for user:
| SimplePrincipal role = new SimplePrincipal("role_of_user");
| groups[0].addMember(role);
| return groups;
| }
|
| /**Get password of current user
| * @return Password of user
| * @throws LoginException If user was not found
| */
| protected String getUsersPassword() throws LoginException
| {
| String user = super.getUsername();
| if (user.equals ("root") )
| {
| return "rootpassword";
| }
| }
|
I think you should not override method "login", but "getRoleSets" and "getUsersPassword"
Hope this helps
Wolfgang
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207364#4207364
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4207364
More information about the jboss-user
mailing list