aspose file tools*
The moose likes JBoss/WildFly and the fly likes jboss form based database login using login-config  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "jboss form based database login using login-config  " Watch "jboss form based database login using login-config  " New topic
Author

jboss form based database login using login-config

sumeet mahajan
Greenhorn

Joined: Jul 20, 2008
Posts: 2
jboss-web.xml contains
<jboss-web>
<security-domain>java:/jaas/wizomLogin</security-domain>
<context-root>/test</context-root>
</jboss-web>

login.html
<html>
<body>
<h1>Please Authenticate</h1>
<form method="POST" action="j_security_check">
User Name: <input type="text" name="j_username" /><br />
Password: <input type="password" name="j_password" /><br />
<input type="submit" value="Login" />
</form>
</body>
</html>
web.xml contains
<web-app>
<description>A test app for security</description>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>All resources</web-resource-name>
<description>Protects all resources</description>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>WebAppUser</role-name>
</auth-constraint>
</security-constraint>

<security-role>
<role-name>WebAppUser</role-name>
</security-role>

<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.html</form-error-page>
</form-login-config>
</login-config>

</web-app>
login-config.xml conatins
<application-policy name = "wizomLogin">
<authentication>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
<module-option name = "dsJndiName">java:mySqlWizom</module-option>
<module-option name = "principalsQuery">Select password from userInfo where userInfo.username=?</module-option>
<module-option name = "rolesQuery">Select role,'Roles' from wizomRole where wizomRole.username=?</module-option>
<module-option name="unauthenticatedIdentity">guest</module-option>
</login-module>
</authentication>
</application-policy>
database conatins tables
userInfo with username and password
wizom wizom
wizomRole with username and role
wizom WebUserApp

still login does not work
instead if i used application policy that reads username password roles from file that will work.

please post me the solution.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

It would help if you used ubb tags so that the source would be easier to read. (You can edit your post to add the codes, click on the icon showing a pencil over a piece of paper at the top of your post.)

Are there an error shown in the console log? Is the mySqlWizom data source properly define (you did not post the *-ds.xml file)? Did the console log show the data source being deployed?


JBoss In Action
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10285
    
169

"farzi farzi"

Please check your private message for a message from JavaRanch.


[My Blog] [JavaRanch Journal]
sumeet mahajan
Greenhorn

Joined: Jul 20, 2008
Posts: 2
datasource is deployed properly.
its there in the log.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"farzi farzi",
Again, please check your private messages regarding an important administrative matter.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"sumeet",
Please check your private messages, again.
-Ben
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"sumeet s",
Your account is about to be closed.
You've been given the following instructions more that 3 times now and continue to set your account up with invalid screen names.
If you post to the ranch again with an invalid screen name or change your screen name to something else that is invalid, your account will be closed.

-Ben

PS: Disabling your private messages is not the way to deal with this issue.

Here are the instructions, again:

Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. Initials are OK for the first and middle names but not the last. You can change it here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jboss form based database login using login-config