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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • The SPACE Framework for Developer Productivity
  • Design Patterns for Microservices: Ambassador, Anti-Corruption Layer, and Backends for Frontends
  • A Complete Guide to AWS File Handling and How It Is Revolutionizing Cloud Storage
  • RBAC With API Gateway and Open Policy Agent (OPA)

Trending

  • The SPACE Framework for Developer Productivity
  • Design Patterns for Microservices: Ambassador, Anti-Corruption Layer, and Backends for Frontends
  • A Complete Guide to AWS File Handling and How It Is Revolutionizing Cloud Storage
  • RBAC With API Gateway and Open Policy Agent (OPA)
  1. DZone
  2. Coding
  3. Java
  4. Security Features of JBoss AS 5.1 - Part 1 - Simplified Security Domain Configuration

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
Share
34.85K 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.

Trending

  • The SPACE Framework for Developer Productivity
  • Design Patterns for Microservices: Ambassador, Anti-Corruption Layer, and Backends for Frontends
  • A Complete Guide to AWS File Handling and How It Is Revolutionizing Cloud Storage
  • RBAC With API Gateway and Open Policy Agent (OPA)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • 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

Let's be friends: