Database Login Module - JBoss

25 September, 2020


Related Blogs


Database Login Module - JBoss

Fetches login info from an RDBMS 

Works with existing DB schemas

Uses pooled database connections

Scales well as the user population grows

Does not require server or application restarts on info change 14.6.1. MySQL Schema/DB Setup

Database Login Module depends on our ability to set up (and link to) a JBoss-managed DataSource (database connection pool).

To enrich your career and become a JBoss professional, visit Tekslate, the global online training platform:" JBoss Training". This course will help you achieve excellence in this field.

term#> mysql/bin/mysql -u root -p mysql> CREATE DATABASE Authority; mysql> USE Authority; mysql> CREATE TABLE Users (Username VARCHAR(32) NOT NULL PRIMARY KEY,Password VARCHAR(32) NOT NULL); mysql> CREATE TABLE Roles (Username VARCHAR(32) NOT NULL,Rolename VARCHAR(32) NOT NULL,PRIMARY KEY (Username, Rolename)); mysql> GRANT SELECT ON Authority.* TO authority@localhost IDENTIFIED BY "authsecret"; It is important that the password field be at least 32 characters in order to accommodate MD5-digest-based passwords (more on this later). You do not have to create a separate database, nor do you need separate tables, but we assume that we are starting from scratch. The default JBoss AS schema for User/Role information is as follows:

Table Principals(PrincipalID text, Password text)

Table Roles(PrincipalID text, Role text, RoleGroup text) Populate the database. For example:

You also do not need an auth-specific read-only database user, but we create one because it is a good practice.

INSERT INTO Users VALUES ("john", "secret"); INSERT INTO Roles VALUES ("john", "MyRole"); INSERT INTO Users VALUES ("bob", "abc123"); INSERT INTO Roles VALUES ("bob", "MyRole"); INSERT INTO Roles VALUES ("bob", "Manager"); INSERT INTO Users VALUES ("mike", "passwd"); INSERT INTO Roles VALUES ("mike", "Manager"); INSERT INTO Roles VALUES ("mike", "Admin"); Authority Database Resource Create deploy/authority-ds.xml:


Define a database connection pool (resource) that will provide connectivity to the Authority database.

For an in-depth understanding on JBoss click on:

About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .