• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set the security role name?  RSS feed

 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you set a users role (security role name), when the role is defined in a database where the user has a username, password and a usertype (role name)?

I understand that you can define some roles which have access to a certain servlet.

<security-role-ref>
<role-name>Admin</role-name>
<role-link>Administrator</role-link>
</security-role-ref>

- and that you can test who the user is:

if ( request.isUserInRole("Admin") )
response.sendRedirect("../..");

- But how do you set the users role name when he logins the application. I expect something like: setUserRole("Admin") but maybe I do misunderstand how it works?

Thanks
 
Charles GAY
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
you should look towards the jGuard project(http://jguard.sourceforge.net) to have this feature and many others.

hope it helps,

Charles(jGuard team).
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"diabolo diabolo",
I've been browsing your posts and I appreciate the help you've been giving, but unfortunately your diaply name is not valid and accounts with invalid display names get deleted, often without warning.

We require display names to be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and select a valid diaply name.

thanks,
Dave.
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have looked at the jGuards homepage. I haven�t found a solution yet. Isn�t it possible to solve without using jGuard? Maybe you can give a more precisely hint? :-)
[ June 20, 2005: Message edited by: Jeppe Fjord ]
 
Charles GAY
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
to be more precise, in jGuard (http://jguard.sourceforge.net), users can have multiple roles defined either in an XML file, or a database implementation (oracle, mysql, postgresql,DB2 and MS SQL server).
it's the Authentication side, and is handled by the AuthenticationManager in jGuard.

roles of user, defined sometimes in a central repository, can be matched with the local roles of your application.
these 'local' roles can have multiple permissions.
it's the Authorization part of jGuard.
this stuff is handled by the AuthorizationManager in jGuard.
like AuthenticationManager and AuthorizationManager can be called at runtime, and provide convenience methods to update datas, it seems that your needs are completed.
=> a webapp which manage these classes is provided in the jGaurd distribution.

hope it helps,

Charles(jGuard team).
ps: you can have more support on the jGuard forum (all the team has got a look on it).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!