• 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

jboss form based database login using login-config

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
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
"farzi farzi"

Please check your private message for a message from JavaRanch.
 
sumeet mahajan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
datasource is deployed properly.
its there in the log.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"farzi farzi",
Again, please check your private messages regarding an important administrative matter.
-Ben
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"sumeet",
Please check your private messages, again.
-Ben
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic