Version 31

    << Back to JBossAS7: Security Design One Stop Article


    JBoss AS 7.0 and beyond come with a new domain model where the configuration for the entire Application Server is centralized. This article will highlight the domain model settings for Security.  We also give links to other areas of security that may be relevant to the awesome JBoss AS users.


    Locations of the domain model

    Standalone Configuration



    Domain Configuration




    Example of the security domain model


    <subsystem xmlns="urn:jboss:domain:security:1.0">
            <security-domain name="other">
                    <login-module code="UsersRoles" flag="required" />
           <security-domain name="form-auth" cache-type="default">
                           <login-module code="UsersRoles" flag="required">
                                <module-option name="usersProperties" value=""/>
                                <module-option name="rolesProperties" value=""/>
          <property name="a" value="b" />
          <property name="c" value="d" />


    In the above example, we are defining a block for Security Domains.  In this case, we define a security domain "other". Underneath, we define the login module (UsersRolesLoginModule). Remember, we do not need to specify the fully qualified name of the login module.


    We also define a block for properties that are set on

    Security Domains


    The mapping of shortened names for login modules to the standard login modules available in JBoss AS is provided below.  The latest is always available in the class


    NameActual Login Module














    Using custom login module

    Just write the FQCN in the code attribute and it should work out of the box.


    To place the custom login module class files, you can place them in a jar and put it either:

    • application classpath of your web archive (war) or ejb jar or enterprise archive (ear)  OR
    • separate module under the modules directory.



    Deploying dynamic security domains


    Marcus Moyses talks about it here.  You have to use the CLI.


    You can add it via CLI using:

    Deploying Custom Tomcat Authenticators in AS7


    Thanks to Darran Lofthouse for the sample. Add the valve configuration into the jboss-web.xml of your web archive.



    Note that this is a general pattern to configure tomcat valves in JBoss AS7. Configure them in jboss-web.xml


    One more example:



    JCA - Datasource Security

    Historically, the JCA login modules in JBoss AS have been described here:  [This information is primarily for JBoss AS5/6]  But you can get an idea on the login modules.


    Here is an example of a security domain that is referenced by a data source:


     <security-domain name="DsRealm" cache-type="default">
                <login-module code="ConfiguredIdentity" flag="required">
                     <module-option name="userName" value="sa"/>
                     <module-option name="principal" value="sa"/>
                     <module-option name="password" value="sa"/>

    Remember, you can mask the password by using the vault facility in AS71.


    How would this get used?  Example security-ds.xml is below.


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



         <datasource jndi-name="java:jboss/datasources/securityDs"




              <new-connection-sql>select current_user()</new-connection-sql>








    Security Auditing




    JACC (JSR-115) on JBoss AS7.1





    Where is JaasSecurityDomain in AS7?

    It has been replaced by the jsse xml element in the security subsystem configuration.


    Additional Reference


    JBoss AS Security Subsystem Configuration






    Running JBoss AS7 under a Java Security Manager



    Choosing SSO for your JBoss Application Server