File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Some JAAS questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Some JAAS questions" Watch "Some JAAS questions" New topic
Author

Some JAAS questions

Sebastiaan Kortleven
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
Hi there,
I'm trying to get an applet running using JBoss3.2.3 as AS. I would like to have JAAS handle the security issues..
So I took a look at
http://www.coderanch.com/t/88165/JBoss/JAAS-JBOSS-Tutorial
and many other documents (sigh) but I couldn't find the answer on some of my questions:
* I know how to secure a webpage, a client will ask a secured page and tomcat will redirect you to a login page, but how does this work in an application? Will the AS ask me to login if I try to connect to a secured bean, or does the app have to login first, and then access the beans?
* If the app has to login first, I read in the how-to to use some code like this:
ctx = new LoginContext("secDomain", (CallbackHandler)handler);
ctx.login();
with secDomain the same name as the one defined in the jboss.xml on the AS. But how is the app supposed to know where to find the server? Shouldn't I include some kind of properties file telling the app on what Ip ort the server is running?
* If I add the lines below to my login-config.xml I get an error on starting JBoss:
<application-policy name="lmsintl">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName">java:/appsettings</module-option>
<module-option name="principalsQuery">Select password from User where username = ?</module-option>
<module-option name="rolesQuery">Select role as Role from Roles where username = ?</module-option>
</login-module>
</authentication
</application-policy>
The error is:
10:26:18,020 WARN [XMLLoginConfigImpl] Failed to load config: file:/D:/jboss-3.
2.3/server/lms/conf/login-config.xml
org.jboss.security.auth.login.ParseException: Encountered "<?xml" at line 1, column 1.
Was expecting one of:
<EOF>
<IDENTIFIER> ...
My head is hurting from bamging it against my keyboard.. I'm a great fan of OS but some more documentation wouldn't hurt..
Thanks in advance!
Sebastiaan
[ March 12, 2004: Message edited by: Sebastiaan Kortleven ]
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 566
The ParseException is complaining about your login-config.xml.
My login-config.xml starts off with the line:
<?xml version='1.0'?>
which causes no problems and seems logical. It seems like the parser is giving the wrong error message. Have another look at the file and see if there are any other XML errors.


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Sebastiaan Kortleven
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
I validated the xml file and it came out correct, so it wasn't a syntax error.
I moved the lines I added to the top of the file and now it works just fine..
tnx!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Some JAAS questions