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 > Basic Hints on Security Configuration
Date Fri, 17 Jul 2009 03:41:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=GMOxDOC22&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/GMOxDOC22/Basic+Hints+on+Security+Configuration">Basic
Hints on Security Configuration</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~chirunhua@gmail.com">Runhua
Chi</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="BasicHintsonSecurityConfiguration-Whereisthesecurityconfiguration%3F"></a>Where
is the security configuration?</h2>

<p>In a normal Geronimo server, the basic security configuration is divided into two
plugins, <b>j2ee-security</b> and <b>server-security-config</b>. 
The parts you are not too likely to want to change, such as the jacc provider and the keystore
manager, are in j2ee-security.  The parts that you are almost certain to want to change is
in server-security config.  For instance, the toy properties file security realm for the admin
console is in server-security-config.</p>

<h3><a name="BasicHintsonSecurityConfiguration-SoIhaveanenterprisewideauthenticationsystem....howdoIsetitupforallmyapps%3F"></a>So
I have an enterprise wide authentication system.... how do I set it up for all my apps?</h3>

<p>You want to replace server-security-config with your own Geronimo plugin (see <a
href="/confluence/display/GMOxDOC22/Administering+plugins" title="Administering plugins">Administering
plugins</a>) that contains a security realm customized for your security setup (e.g.
ldap) and includes whatever keystores you need. To replace all uses of server-security-config
with your plugin, include an artifact-alias element in your <tt>geronimo-plugin.xml</tt>
file.</p>
<style type="text/css">
@import url(/confluence/download/resources/confluence.ext.code:code/shStyles.css);
</style>
<!--[if IE]>
<style type="text/css">
    .code textarea, .code input { padding: 0 !important; }
</style>
<![endif]-->
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shCore.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushCSharp.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushPhp.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushJScript.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushVb.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushSql.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushXml.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushShell.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushDelphi.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushPython.js"></script>
<script class="javascript" src="/confluence/download/resources/confluence.ext.code:code/shBrushJava.js"></script>
<div class="code">
<textarea name="newcodemacro" class="java:nocontrols:nogutter" rows="10" readonly="readonly">&lt;artifact-alias
key="org.apache.geronimo.framework/server-security-config/2.2-SNAPSHOT/car"&gt;com.myco/myco-security-config/1.0/car&lt;/artifact-alias&gt;
&lt;artifact-alias key="org.apache.geronimo.framework/server-security-config//car"&gt;com.myco/myco-security-config/1.0/car&lt;/artifact-alias&gt;</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>

<p>Another option is to use maven with the car-maven-plugin. The above code would need
to be included in the car-maven-plugin configuration in <tt>pom.xml</tt>.</p>

<p>Note that if you want the admin console and MEJB to continue working without redeployment,
you have to include a security realm named <em>geronimo-admin</em>.  geronimo-admin
should supply supply appropriate users with principals of class org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal
and names of (as appropriate) admin (for console and MEJB read access) and mejbadmin (for
MEJB write access).</p>

<p>As with any geronimo plugin, you can include any jars in the plugin's classloader
by installing the jars in the geronimo repository and listing them as dependencies in the
geronimo plan. The car-maven-plugin can be used to make the geronimo dependencies the same
as the maven dependencies and to have plugin installation also install all the needed jars.</p>

<h3><a name="BasicHintsonSecurityConfiguration-I%27mstilldoingexperimentsandamnotreadytowriteaplugin...howdoIusearealmIcreatedintheadminconsole%3F"></a>I'm
still doing experiments and am not ready to write a plugin... how do I use a realm I created
in the admin console?</h3>

<p>While getting all your configuration into plugins with source code in scm and built
by maven provides a completely reproducible environment, you might want to experiment with
a security realm you set up using the admin console.  In this case you need to, while geronimo
is stopped, edit the <tt>var/config/artifact-aliases.properties</tt> file by hand.
 Assuming that you named the configuration <em>geronimo-admin</em> the console
will come up with a plugin id of console.realm/geronimo-admin/1.0/car.  You need to put lines
like:</p>

<div class="code">
<textarea name="newcodemacro" class="java:nocontrols:nogutter" rows="10" readonly="readonly">org.apache.geronimo.framework/server-security-config/2.2-SNAPSHOT/car=console.realm/geronimo-admin/1.0/car
org.apache.geronimo.framework/server-security-config//car=console.realm/geronimo-admin/1.0/car</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>

<p>where you've replaced <em>2.2-SNAPSHOT</em> with the actual version of
geronimo you are using.</p>

<h3><a name="BasicHintsonSecurityConfiguration-Whoneedsenterprisewide%3FIwantmyapptoincludeitsownsecuritysetup%21"></a>Who
needs enterprise-wide?  I want my app to include its own security setup!</h3>

<p>You can also include security realm configuration, keystores, and credential stores
in your geronimo plan for your application.  Just put the gbean configurations at the end
after the javaee specific configuration.  In this case you may not want to remove the standard
server-security-config as removing it would prevent the admin console or mejb from starting.</p>

<h3><a name="BasicHintsonSecurityConfiguration-ForWebapplicationsusingSpringSecurity"></a>For
Web applications using Spring Security</h3>

<p>Spring security may secure spring applications but it won't relate to container managed
authorization in Geronimo unless you do something to hook it up.  You need some code that
looks vaguely like this:</p>

<div class="code">
<textarea name="newcodemacro" class="java:nocontrols:nogutter" rows="10" readonly="readonly">Subject
subject = getSpringAuthenticatedSubject();
ContextManager.registerSubject(subject); //if the subject is cached in a session this should
only happen once when the subject is first authenticated/constructed.

//the following should happen on every request
ContextManager.setCallers(subject, subject);
try {
//process request
} finally {
   ContextManager.clearCallers();
}</textarea>
<script class="javascript">
    if(!window.newcodemacro_initialised)
    {
        window.newcodemacro_initialised = true;
        window.oldonloadmethod = window.onload;
        window.onload = function(){
            dp.SyntaxHighlighter.HighlightAll('newcodemacro');
            if(window.oldonloadmethod)
            {
                window.oldonloadmethod();
            }
        }
    }

</script>
</div>

     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/GMOxDOC22/Basic+Hints+on+Security+Configuration">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=93351&revisedVersion=9&originalVersion=8">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/GMOxDOC22/Basic+Hints+on+Security+Configuration?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message