Group Discounts available for 3+ students and Corporate Clients

Configure DB Login Module in JBoss

Configure DB Login Module in JBoss

Add to conf/login-config.xml:

  • <application-policy name=”MyPolicy”>
  • <authentication>
  • <login-module flag=”required” code=””>
  • <module-option name=”dsJndiName”>java:/AuthorityDB</module-option>
  • <module-option name=”principalsQuery”>SELECT Password FROM Users WHERE Username=?</module-option>
  • <module-option name=”rolesQuery”>SELECT Rolename, “Roles” FROM Roles WHERE Username=?</module-option>
  • </login-module>
  • </authentication>
  • </application-policy>

Application policy name declares a new policy. We will reference this name in each [web] application that wishes to use it.

Interested in mastering JBOSS? Learn more about JBOSS Tutorial in this blog post.

The required flag means that the login module is required to succeed.

If it succeeds or fails, authentication still continues to proceed down the LoginModule list

Other options are: requisite, sufficient, and optional

Module option dsJndiName:

Defines the JNDI name of the RDBMS DataSource that defines logical users and roles tables

Defaults to java:/DefaultDS

Module option principalsQuery:

Defines a prepared SQL statement that queries the password of a given username

Defaults to select Password from Principals where PrincipalID=?

Module option rolesQuery:

Defines a prepared SQL statement that queries role names (and groups) of a given username

The default group name is Roles (hard-coded). Defaults to select Role, RoleGroup from Roles where PrincipalID=?

For indepth understanding on JBoss click on:

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at, we will update the article in 24 hours.”

0 Responses on Configure DB Login Module in JBoss"

Leave a Message

Your email address will not be published. Required fields are marked *


Please Enter Your Details and Query.
Three + 6