<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/LoginModules">LoginModules</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
    </h4>
        <br/>
                         <h4>Changes (4)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-changed-lines" >LoginModules are an essential part of the JAAS security framework and provide Teiid customizable user authentication and the ability to reuse existing LoginModules defined for JBossAS. <span class="diff-added-words"style="background-color: #dfd;">Refer to the JBoss Application Server security documentation for information about configuring security in JBoss Application Server, [http://docs.jboss.org/jbossas/admindevel326/html/ch8.chapter.html].</span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>Teiid can be configured with multiple named application policies that group together relevant LoginModules. Each of these application policy \(or domain) names can be used to fully qualify user names to authenticate only against that domain.   <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >You can install multiple login modules as part of single security domain configuration and configure them to be part of the login process. For example, for &quot;teiid\-security&quot; domain, you can configure a file based and also LDAP based login modules, and have your user authenticated with either or both login modules.  If you want to write your own custom login module, refer to the [Developer&#39;s Guide] for instructions.   <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">For all the available login modules refer to [http://community.jboss.org/docs/DOC-11287]. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>h2. Text Based LoginModule <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-added-words"style="background-color: #dfd;">Refer to [http://community.jboss.org/docs/DOC-12510].</span> The _UsersRolesLoginModule_ utilizes simple text files to authenticate users and to define their groups. The below XML fragment under &quot;security&quot; subsystem shows a Text based login module. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:XML|title=standalone-teiid.xml}         <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{note} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h2. LDAP Based LoginModule <br>See [LDAP LoginModule configuration|http://community.jboss.org/docs/DOC-11253] for the AS community guide.  The following are streamlined installation instructions. <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{note}If using SSL to the LDAP server, ensure that the Corporate CA Certificate is added to the JRE trust store.{note} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;"> <br>h2. Database LoginModule <br>Login module that uses Database-based authentication. Refer to [http://community.jboss.org/docs/DOC-9511]. <br> <br>h2. Cert LoginModule <br>Login module that uses X509 certificate based authentication. See [http://community.jboss.org/docs/DOC-9160]. <br> <br>h1. Custom LoginModules <br> <br>If your authentication needs go beyond the provided LoginModules, please refer to the JAAS development guide at [http://java.sun.com/j2se/1.5.0/docs/guide/security/jaas/JAASLMDevGuide.html]. There are also numerous guides available. <br> <br>If you are extending one of the built-in LoginModules, refer to [http://community.jboss.org/docs/DOC-9466]. <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>LoginModules are an essential part of the JAAS security framework and provide Teiid customizable user authentication and the ability to reuse existing LoginModules defined for JBossAS. Refer to the JBoss Application Server security documentation for information about configuring security in JBoss Application Server, <a href="http://docs.jboss.org/jbossas/admindevel326/html/ch8.chapter.html" class="external-link" rel="nofollow">http://docs.jboss.org/jbossas/admindevel326/html/ch8.chapter.html</a>.</p>

<p>Teiid can be configured with multiple named application policies that group together relevant LoginModules. Each of these application policy &#40;or domain) names can be used to fully qualify user names to authenticate only against that domain.  </p>

<p>The format for a qualified name is </p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
username@domainname
</pre>
</div></div>  

<p>The security&#45;domain attribute under the transport element in "teiid" subsystem in the <tt>&lt;jboss&#45;install&gt;/standalone/configuration/standalone&#45;teiid.xml</tt> file is used set the comma separated list of desired domains.  For example, in default configuration under "teiid" subsystem you will find</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: xml; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
  &lt;transport name="jdbc" protocol="teiid" socket-binding="teiid-jdbc"&gt;
     &lt;ssl mode="login"/&gt;
     &lt;authentication security-domain="teiid-security"/&gt;
  &lt;/transport&gt;
</pre>
</div></div>

<p>If a user name is not fully qualified, then the installed domains will be consulted in order until a domain successfully or unsuccessfully authenticates the user.</p>

<p>If no domain can authenticate the user, the login attempt will fail. Details of the failed attempt including invalid users, which domains were consulted, etc. will be in the server log with appropriate levels of severity.</p>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The "security&#45;domain" defined for each transport type can be different under Teiid. So, effectively one can configure different transports for JDBC or ODBC or multiple JDBC ports with different security domains</td></tr></table></div>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>In existing installations an appropriate security domain may already be configured for use by administrative clients &#40;typically for "admin&#45;console"). If the admin connections &#40;CLI and adminshell) are not secured, it is recommended that you secure that interface by executing "add-user.sh" script in the "bin/scripts" directory.</td></tr></table></div>

<h1><a name="LoginModules-Built%5CinLoginModules"></a>Built&#45;in LoginModules</h1>
<p>JBossAS provides several LoginModules for common authentication needs, such as authenticating from a <a href="#LoginModules-TextBasedLoginModule">Text Based LoginModule</a> or a <a href="#LoginModules-LDAPBasedLoginModule">LDAP Based LoginModule</a>.</p>

<p>You can install multiple login modules as part of single security domain configuration and configure them to be part of the login process. For example, for "teiid&#45;security" domain, you can configure a file based and also LDAP based login modules, and have your user authenticated with either or both login modules.  If you want to write your own custom login module, refer to the <a href="/author/display/TEIID/Developer%27s+Guide" title="Developer&#39;s Guide">Developer's Guide</a> for instructions.  </p>

<p>For all the available login modules refer to <a href="http://community.jboss.org/docs/DOC-11287" class="external-link" rel="nofollow">http://community.jboss.org/docs/DOC-11287</a>.</p>

<h2><a name="LoginModules-TextBasedLoginModule"></a>Text Based LoginModule</h2>
<p>Refer to <a href="http://community.jboss.org/docs/DOC-12510" class="external-link" rel="nofollow">http://community.jboss.org/docs/DOC-12510</a>. The <em>UsersRolesLoginModule</em> utilizes simple text files to authenticate users and to define their groups. The below XML fragment under "security" subsystem shows a Text based login module. </p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>standalone-teiid.xml</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: xml; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">        
 &lt;subsystem xmlns="urn:jboss:domain:security:1.1"&gt;
    &lt;security-domains&gt;
        &lt;security-domain name="teiid-security" cache-type="default"&gt;
            &lt;authentication&gt;
                &lt;login-module code="UsersRoles" flag="required"&gt;
                    &lt;module-option name="usersProperties" value="teiid-security-users.properties"/&gt;
                    &lt;module-option name="rolesProperties" value="teiid-security-roles.properties"/&gt;
                &lt;/login-module&gt;
            &lt;/authentication&gt;
        &lt;/security-domain&gt;
    &lt;/security-domains&gt;
&lt;/subsystem&gt;
</pre>
</div></div>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The <em>UsersRolesLoginModule</em> is not recommended for production use and is strongly recommended that you replace this login module.</td></tr></table></div>


<p>User names and passwords are stored in the <em>&lt;jboss&#45;as&gt;/standalone/configuration/teiid&#45;security&#45;users.properties</em> file.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Example user.properties file</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
# A users.properties file for use with the UsersRolesLoginModule
# username=password

fred=password
george=password
...
</pre>
</div></div>

<p>JAAS role assignments are stored in the <em>&lt;jboss&#45;as&gt;/standalone/configuration/teiid&#45;security&#45;roles.properties</em> file. </p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Example user.properties file</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
# A roles.properties file for use with the UsersRolesLoginModule
# username=role1,role2,...

data_role_1=fred,sally
data_role_2=george
</pre>
</div></div>

<p>User and role names are entirely up to the needs of the given deployment.  For example each application team can set their own security constraints for their VDBs, by mapping their VDB data roles to application specific JAAS roles, e.g. app&#95;role&#95;1=user1,user2,user3. </p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Teiid data roles names are independent of JAAS roles.  VDB creators can choose whatever name they want for their data roles, which are then mapped at deployment time to JAAS roles.</td></tr></table></div>

<h2><a name="LoginModules-LDAPBasedLoginModule"></a>LDAP Based LoginModule</h2>
<p>See <a href="http://community.jboss.org/docs/DOC-11253" class="external-link" rel="nofollow">LDAP LoginModule configuration</a> for the AS community guide.  The following are streamlined installation instructions.</p>

<p>Configure LDAP authentication by editing <em>standalone&#45;teiid.xml</em> under "security" sub system.  Once the security-domain is defined, then edit the "security-domain" attribute for Teiid's "transport" for which you want use this LDAP login.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>standalone-teiid.xml</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: xml; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
&lt;subsystem xmlns="urn:jboss:domain:security:1.1"&gt;
    &lt;security-domains&gt;
        &lt;security-domain name="ldap_security_domain"&gt;
            &lt;authentication&gt;
                &lt;login-module code="LdapExtended" flag="required"&gt;
                    &lt;module-option name="java.naming.factory.initial" value="com.sun.jndi.ldap.LdapCtxFactory" /&gt;
                    &lt;module-option name="java.naming.provider.url" value="ldap://mydomain.org:389" /&gt;
                    &lt;module-option name="java.naming.security.authentication" value="simple" /&gt;
                    &lt;module-option name="bindDN" value="myuser" /&gt;
                    &lt;module-option name="bindCredential" value="mypasswd" /&gt;
                    &lt;module-option name="baseCtxDN" value="ou=People,dc=XXXX,dc=ca" /&gt;
                    &lt;module-option name="baseFilter" value="(cn={0})" /&gt;
                    &lt;module-option name="rolesCtxDN" value="ou=Webapp-Roles,ou=Groups,dc=XXXX,dc=ca" /&gt;
                    &lt;module-option name="roleFilter" value=(member={1}) " /&gt;
                    &lt;module-option name="uidAttributeID" value="member" /&gt;
                    &lt;module-option name="roleAttributeID" value="cn" /&gt;
                    &lt;module-option name="roleAttributeIsDN" value="true" /&gt;
                    &lt;module-option name="roleNameAttributeID" value="cn" /&gt;
                    &lt;module-option name="roleRecursion" value="-1" /&gt;
                    &lt;module-option name="searchScope" value="ONELEVEL_SCOPE" /&gt;
                    &lt;module-option name="allowEmptyPasswords" value="false" /&gt;
                    &lt;module-option name="throwValidateError" value="true" /&gt;
                &lt;/login-module&gt;
                &lt;login-module code="org.jboss.security.auth.spi.RoleMappingLoginModule" flag="optional"&gt;
                    &lt;module-option name="rolesProperties" value="${jboss-install}/standalone/configuration/roles.properties" /&gt;
                    &lt;module-option name="replaceRole" value="false" /&gt;
                &lt;/login-module&gt;
            &lt;/authentication&gt;
        &lt;/security-domain&gt;
    &lt;/security-domains&gt;
&lt;/subsystem&gt;
</pre>
</div></div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>If using SSL to the LDAP server, ensure that the Corporate CA Certificate is added to the JRE trust store.</td></tr></table></div>

<h2><a name="LoginModules-DatabaseLoginModule"></a>Database LoginModule</h2>
<p>Login module that uses Database-based authentication. Refer to <a href="http://community.jboss.org/docs/DOC-9511" class="external-link" rel="nofollow">http://community.jboss.org/docs/DOC-9511</a>.</p>

<h2><a name="LoginModules-CertLoginModule"></a>Cert LoginModule</h2>
<p>Login module that uses X509 certificate based authentication. See <a href="http://community.jboss.org/docs/DOC-9160" class="external-link" rel="nofollow">http://community.jboss.org/docs/DOC-9160</a>.</p>

<h1><a name="LoginModules-CustomLoginModules"></a>Custom LoginModules</h1>

<p>If your authentication needs go beyond the provided LoginModules, please refer to the JAAS development guide at <a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/jaas/JAASLMDevGuide.html" class="external-link" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/guide/security/jaas/JAASLMDevGuide.html</a>. There are also numerous guides available.</p>

<p>If you are extending one of the built-in LoginModules, refer to <a href="http://community.jboss.org/docs/DOC-9466" class="external-link" rel="nofollow">http://community.jboss.org/docs/DOC-9466</a>.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/LoginModules">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=18646062&revisedVersion=11&originalVersion=10">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/LoginModules?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>