Skip to content

Instantly share code, notes, and snippets.

@steppat
Created September 27, 2013 13:51
Show Gist options
  • Save steppat/6728896 to your computer and use it in GitHub Desktop.
Save steppat/6728896 to your computer and use it in GitHub Desktop.
JAAS security domain para JBoss AS 7
<!-- no arquivo standalone-jms.xml -->
<security-domain name="lojaDomain" cache-type="default">
<authentication>
<login-module code="Database" flag="required">
<module-option name="dsJndiName" value="java:/livrariaDS"/>
<module-option name="principalsQuery" value="select password from users where user=?"/>
<module-option name="rolesQuery" value="select role, 'Roles' from roles where user like ?"/>
</login-module>
</authentication>
</security-domain>
---------
No mysql execute:
use fj31;
create table users(user varchar(15), password varchar(40), primary key (user) );
create table roles(user varchar(15), role varchar(15), primary key (user, role));
INSERT INTO users VALUES ('joao', 'pass');
INSERT INTO roles VALUES ('joao', 'administrador');
INSERT INTO users VALUES ('maria', 'pass');
INSERT INTO roles VALUES ('maria', 'cliente');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment