tags:

views:

113

answers:

1

I'm using jboss 4.2.3 and jaas org.jboss.security.auth.spi.DatabaseServerLoginModule.

After a user is logged in I want to add a role to it. How can I do it?

For example, the user clicks in a button and a role is added...

Clarification: I have 1 app where a user does the login. In the login the users gets some roles (from the db). After that I want to add another roles to the user in my code. My example is: after the user is logged in, he can click a button and in my servlet a new role is added to the user.

It seems Jboss doesn't allow this, roles can be accessed only in the login module.

A: 

I've been looking for an answer to this problem, and I found that JBoss lets you flush the Credential Cache, programmatically and also by using a MBean:

http://community.jboss.org/wiki/CachingLoginCredentials

You can add the role to the user and then cause that user's credentials to be flushed. As far as I can tell, they have to log out and then log back in to your application; after that happens, they'll have the new role that you gave them.

If there is a way to assign the role without requiring the user to log out and back in, I'd like to hear about it.

Jon