Platinum Partner
server,security,jboss,jboss jbossas jboss_security security jboss5 jboss application server anil_saldhana,jboss as

Security Features of JBoss AS 5.1 - Part 1 - Simplified Security Domain Configuration

JBoss Application Server is a LGPL licensed open source Java EE compliant application server. The v5.1.0 was released recently and can be downloaded from the link in the resources section below.

Historically, the default security domain configuration in JBoss Application Server has been the login-config.xml in the conf directory of your favorite server configuration (default, all etc). The next evolution for an hot deployable configuration was the DynamicLoginConfig mbean service that allowed users to deploy their security domain configuration as part of their application deployment (security domains get deployed when the app deploys and undeploy when the app undeploys).

What are security domains?

The key driver for security for Java EE components such as Web or EJB Components in JBoss Application Server is the concept of a 'security domain'. The security domain is an abstract concept that defines the authentication, authorization, audit, mapping etc. modules in JBoss Application Server 5.

Since JBoss AS 5.x is based on the JBoss Microcontainer, we had an opportunity to provide an additional simplified approach to security domain configuration. This feature exists as of JBoss Application Server v5.0.

There are actually three steps involved in this.

Step 1: Define a file of the format xxx-jboss-beans.xml (Note: xxx can be anything you want, such as, customer-app-jboss-beans.xml etc)

Step 2: Add the following pattern to this file.

<?xml version="1.0" encoding="UTF-8"?>

<deployment xmlns="urn:jboss:bean-deployer:2.0">

<application-policy xmlns="urn:jboss:security-beans:1.0" name="web-test">
<authentication>
<login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
flag = "required">
<module-option name = "unauthenticatedIdentity">anonymous</module-option>
<module-option name="usersProperties">u.properties</module-option>
<module-option name="rolesProperties">r.properties</module-option>
</login-module>
</authentication>
</application-policy>

<application-policy xmlns="urn:jboss:security-beans:1.0" name="ejb-test">
<authentication>
<login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
flag = "required">
<module-option name = "unauthenticatedIdentity">anonymous</module-option>
<module-option name="usersProperties">u.properties</module-option>
<module-option name="rolesProperties">r.properties</module-option>
</login-module>
</authentication>
</application-policy>

</deployment>

Step 3: Either deploy this file directly into the deploy folder or package it as part of your ejb jar (in META-INF) or your web application (war).

You can use any of the login modules that ship with JBoss AS 5.x. More information is available at JBossSX Wiki. Of course you can use your own login modules.

In this example, we have defined two security domains, namely "web-test" and "ejb-test"

Acknowledgement
Thanks to JBoss Security team member, Stefan Guilhen for getting this feature done.

Resources
1) http://server.dzone.com/articles/security-auditing-jboss
2) http://www.jboss.org/community/wiki/DynamicLoginConfig
3) http://www.jboss.org/jbossas/downloads/

4) http://anil-identity.blogspot.com/2009/05/as5-specifying-security-domain.html

 

About the Author

Anil Saldhana is the lead security architect at JBoss. He blogs at http://anil-identity.blogspot.com

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}