DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone >

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

Anil Saldanha user avatar by
Anil Saldanha
·
Jun. 05, 09 · · Interview
Like (0)
Save
Tweet
34.45K Views

Join the DZone community and get the full member experience.

Join For Free

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

security JBoss Application server application

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • 9 Strategies to Improve Your Software Development Process
  • Why to Implement GitOps into Your Kubernetes CI/CD Pipelines
  • Don't Underestimate Documentation
  • Slowness in Java Application Due To Increased FullGC Events: G1GC

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo