geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v2.2 > Configuring login modules
Date Wed, 29 Dec 2010 18:39:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=GMOxDOC22&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://cwiki.apache.org/confluence/display/GMOxDOC22/Configuring+login+modules">Configuring
login modules</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~djencks">David
Jencks</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        document global attribute<br />
    </div>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >    &lt;gbean name=&quot;test-realm&quot;
class=&quot;org.apache.geronimo.security.realm.GenericSecurityRealm&quot;&gt;
<br>        &lt;attribute name=&quot;realmName&quot;&gt;test-realm&lt;/attribute&gt;
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
       &lt;attribute name=&quot;global&quot;&gt;true&lt;/attribute&gt;
<br></td></tr>
            <tr><td class="diff-unchanged" >        &lt;xml-reference name=&quot;LoginModuleConfiguration&quot;&gt;
<br>            &lt;lc:login-config xmlns:lc=&quot;http://geronimo.apache.org/xml/ns/loginconfig-${geronimoSchemaVersion}&quot;&gt;
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>If you specify wrap-principals
as false, your login module will work as usual and only its principals will get into the Subject.
 However if you specify wrap-principals as true, Geronimo will also add principals that wrap
your principals and include the login-domain-name and realm-name of the login module and security
realm that created the principal.  This enables your role-principal mapping to distinguish
between the &quot;same&quot; principal that comes from different sources.  For instance,
if you had two ldap servers where the groups had the same names but the meaning was different
(perhaps users from different departments) you can wrap the principals yet still distinguish
the same group based on the different realms.  However, in order to distinguish principals
in this way, we supply each login module with its own empty Subject object.  Therefore ,a
later login module cannot access the principals added to a Subject by an earlier login module.
 If you need to share information between login modules and also wrap principals, you must
use the shared state map and not the Subject. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>h3. The Global attribute <br> <br>A security realm has a &#39;global&#39;
attribute.  If set to true, it is available to every application and to all ejbs.  If set
to false or omitted, it is only available to web applications that include the plugin containing
the security realm as a dependency (or web applications that include the security realm definition
themselves).  Note that any security realm to be used by ejbs MUST be marked global.  The
reason for non-global security realms is to allow deploying multiple realms with the same
name without conflicts while distinguishing between them using the dependency directed acyclic
graph. <br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Configuringloginmodules-Where%27sthelogin.conffile%3F"></a>Where's
the login.conf file?</h2>

<p>Due to some limitations in the default configuration implementation, Geronimo replaces
login.conf entirely with one that is configured via GenericSecurityRealm GBeans.  This lets
you deploy the security realm you need with your application and allows you to dynamically
add the login module classes to the server as needed.  You can also distinguish between the
same principal when created by different login modules or security realms.</p>

<h2><a name="Configuringloginmodules-SohowdoIconfigureasecurityrealm%3F"></a>So
how do I configure a security realm?</h2>

<p>A typical security realm GBean looks like this:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
    &lt;gbean name=<span class="code-quote">"test-realm"</span> class=<span
class="code-quote">"org.apache.geronimo.security.realm.GenericSecurityRealm"</span>&gt;
        &lt;attribute name=<span class="code-quote">"realmName"</span>&gt;test-realm&lt;/attribute&gt;
        &lt;attribute name=<span class="code-quote">"global"</span>&gt;<span
class="code-keyword">true</span>&lt;/attribute&gt;
        &lt;xml-reference name=<span class="code-quote">"LoginModuleConfiguration"</span>&gt;
            &lt;lc:login-config xmlns:lc=<span class="code-quote">"http:<span
class="code-comment">//geronimo.apache.org/xml/ns/loginconfig-${geronimoSchemaVersion}"</span>&gt;
</span>                &lt;lc:login-module control-flag=<span class="code-quote">"REQUIRED"</span>
wrap-principals=<span class="code-quote">"<span class="code-keyword">false</span>"</span>&gt;
                    &lt;lc:login-domain-name&gt;test-realm&lt;/lc:login-domain-name&gt;
                    &lt;lc:login-module-class&gt;org.apache.geronimo.itest.TestLoginModule&lt;/lc:login-module-class&gt;
                    &lt;lc:option name=<span class="code-quote">"users"</span>&gt;foo,bar&lt;/lc:option&gt;
                &lt;/lc:login-module&gt;
            &lt;/lc:login-config&gt;
        &lt;/xml-reference&gt;
        &lt;reference name=<span class="code-quote">"ServerInfo"</span>&gt;
            &lt;name&gt;ServerInfo&lt;/name&gt;
        &lt;/reference&gt;
    &lt;/gbean&gt;
</pre>
</div></div>

<p>Most of the innards here are similar to the login.conf file, converted to xml.  You
can include as many login-module elements as you need. The control flag is specified as an
attribute of this element.  Each login module needs a login-domain-name that is unique within
the security realm.  You can include as many options as you need.  Geronimo will supply these
options for all login modules so that the login modules can use them without declaring them
in the configuration:</p>
<ul>
	<li>org.apache.geronimo.security.realm.GenericSecurityRealm.KERNEL - the Geronimo kernel</li>
	<li>org.apache.geronimo.security.realm.GenericSecurityRealm.SERVERINFO - the ServerInfo
object that lets you find stuff in the Geronimo server file layout</li>
	<li>org.apache.geronimo.security.realm.GenericSecurityRealm.CLASSLOADER - the classloader
of the plugin that defines the security realm.  Note that this may be different from the classloader
of a plugin that is using the security realm.</li>
</ul>


<p>If you specify wrap-principals as false, your login module will work as usual and
only its principals will get into the Subject.  However if you specify wrap-principals as
true, Geronimo will also add principals that wrap your principals and include the login-domain-name
and realm-name of the login module and security realm that created the principal.  This enables
your role-principal mapping to distinguish between the "same" principal that comes from different
sources.  For instance, if you had two ldap servers where the groups had the same names but
the meaning was different (perhaps users from different departments) you can wrap the principals
yet still distinguish the same group based on the different realms.  However, in order to
distinguish principals in this way, we supply each login module with its own empty Subject
object.  Therefore ,a later login module cannot access the principals added to a Subject by
an earlier login module.  If you need to share information between login modules and also
wrap principals, you must use the shared state map and not the Subject.</p>

<h3><a name="Configuringloginmodules-TheGlobalattribute"></a>The Global
attribute</h3>

<p>A security realm has a 'global' attribute.  If set to true, it is available to every
application and to all ejbs.  If set to false or omitted, it is only available to web applications
that include the plugin containing the security realm as a dependency (or web applications
that include the security realm definition themselves).  Note that any security realm to be
used by ejbs MUST be marked global.  The reason for non-global security realms is to allow
deploying multiple realms with the same name without conflicts while distinguishing between
them using the dependency directed acyclic graph.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC22/Configuring+login+modules">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=93260&revisedVersion=5&originalVersion=4">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC22/Configuring+login+modules?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message