aspose file tools*
The moose likes JBoss/WildFly and the fly likes JAAS + JBOSS 5.1 - getting exception while trying perform authentication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JAAS + JBOSS 5.1 - getting exception while trying perform authentication" Watch "JAAS + JBOSS 5.1 - getting exception while trying perform authentication" New topic
Author

JAAS + JBOSS 5.1 - getting exception while trying perform authentication

Bhavesh Dak
Ranch Hand

Joined: Jun 27, 2009
Posts: 93
Hello friends,

This is first time I am implementing JAAS mechanism in my EJB3.0 + Jboss 5.1.0 applicaiton.
I really appreciate if anybody can guide me to resolve following exception which am getting while performing authentication through standalone Java application.



Please find following client and server side configured xml and Java code.

CLIENT SIDE CONFIGURATION

sample_jaas.config




LoginCallBackHandler.java



TestEJBWithSecurity.java "The test code"




SERVER SIDE CONFIGURATION

%JBOSS_HOME%\server\default\conf\login-config.xml



Note: One strange thing I have noticed it that I am not seeing java:/jaas/SampleAuth anywhere in JBoss Console log

Please help me where the problem is.

Gone through several resources over the net but not finding solution to this issue.

Thanks & Regards
Bhavesh

SCJP 6(83%), SCWCD 5.0(100%)
Bhavesh Dak
Ranch Hand

Joined: Jun 27, 2009
Posts: 93
I don't understand why it requires transaction while executing select queries on database.
It seems I have to give up on this, no progress since last 3 days
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10210
    
166

Are you sure you want to use the DataBaseServerLoginModule on the client side (and not on server side)? That login module requires not just the transaction manager but also the datasource to be accessible on the client side.

[My Blog] [JavaRanch Journal]
Bhavesh Dak
Ranch Hand

Joined: Jun 27, 2009
Posts: 93
Thanks Jai for response,

Are you sure you want to use the DataBaseServerLoginModule on the client side (and not on server side)?


If I do not use this module then what should be the best practice for client side security implementation. My application is going to be a standalone swing application.

That login module requires not just the transaction manager but also the datasource to be accessible on the client side


I have given data source information in config file as below


I have read somewhere that transaction manager is not allowed to be used outside the container then how would I achieve this?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10210
    
166

Perhaps you could write your own login module which doesn't require transaction manager and simply uses JDBC to do the authentication. By the way, you do know that the client side usually passes on the login info (username, password) to the server side (using ClientLoginModule) and doesn't do the real authentication, right? The server is then setup to do the authentication (maybe using DataBaseServerLoginModule for example) and authorization. That way, you don't really need the DataBaseServerLoginModule on the client side. This and this might be of some help.
Bhavesh Dak
Ranch Hand

Joined: Jun 27, 2009
Posts: 93
Before your last post I just got your point of using ClientLoginModule which is enough as far as actual authentication happens at server side where I have used DataBaseServerLoginModule.

I am just done with implementation with ClientLoginModule and changed configuration file with just following,



Now everything (authorization and authentication) is working smoothly with my EJB 3.0 modules.

You really rock Jai, Thanks for your help and Happy Independence day in advance .



Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10210
    
166

Wish you the same!
 
 
subject: JAAS + JBOSS 5.1 - getting exception while trying perform authentication