• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Having major problems setting up a user on JNDI Security using JBoss 5

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to write some simple programs to explore the power of security in EJB 3.0. I am using JBoss 5.
According to this cool and short article: http://community.jboss.org/wiki/JndiLoginInitialContextFactory

I should be able to set up a User / Password on JNDI as described in the article and invoke an EJB method that has security constraints.

Here is my EJB:



Here is the application-policy I added to login-config.xml



Here is user-titan.properties



Here is roles-titan.properties



And here is my stand alone client which runs outside the EJB container.



When I run the client I keep getting:






And I am tearing my hair out about this all day.



Any ideas?



Thanks in Advance.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Luke,

I can give hints on EJB security, I have done this on WSAD but not on JBOSS, so probably you have do extra work/investigation.
Before I jump to the steps what I have done in WSAD, you need to understand whats wrong in code snippet.
You have configured JAAS module in JBOSS server which will be called automatcially whenever you call LoginContext.login(...)
Whenever you use EJB security there are two possiblities/paths:

1. User is already authenticated and authorised before you invoke any EJB method/s.
2. User is not authenticated and authorised before you invoke any EJB method/s.

Case 1: Principals and Credentials (returned by login API) are set in ThreadLocal before you make a call. Once server recevived these data then it trust on caller and check/extract the role information and if role matches with specified role then it allows method invocation otherwise it throws exception.

Case 2 : Whenever you pass user details using Context.SECURITY_PRINCIPAL, Context.SECURITY_CREDENTIALS then server tries to do authentication based on passed details and they are correct then its tries to match roles.

Again that dependces what EJB flow we are talking (i.e. we want that user passes their details and server first do authentication and then role check OR user details are already authenticated and we would like to use Principals and Credentials )

Now in WSAD what we do is , we defines roles and then map roles to methods (using ejb-jar.xml or annotations). before you deploy the build you use WSAD feature to collect all roles defines in EJB-jar.xml and then map these roles to specific OU (org unit). After this you start deployment and container ask you lookup all roles from LDAP or some files and map these roles to your EJB. once this mapping is done,container know what role and OU maps to which role and OU.


Hope that this helps.

Thanks,
Sunil Dixit



 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JNDILoginIntialContextFactory is no longer supported in AS-5. See this recent discussion
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for both answers.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic