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
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: