You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2011/01/31 14:55:33 UTC

svn commit: r1065617 - /karaf/trunk/manual/src/main/webapp/developers-guide/security-framework.conf

Author: gnodet
Date: Mon Jan 31 13:55:32 2011
New Revision: 1065617

URL: http://svn.apache.org/viewvc?rev=1065617&view=rev
Log:
[doc] add some info on the configuration of JAAS using the rank attribute

Modified:
    karaf/trunk/manual/src/main/webapp/developers-guide/security-framework.conf

Modified: karaf/trunk/manual/src/main/webapp/developers-guide/security-framework.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/developers-guide/security-framework.conf?rev=1065617&r1=1065616&r2=1065617&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/developers-guide/security-framework.conf (original)
+++ karaf/trunk/manual/src/main/webapp/developers-guide/security-framework.conf Mon Jan 31 13:55:32 2011
@@ -12,7 +12,7 @@ A very simple XML schema for spring has 
 
 h2. Schema
 
-To deploy a new realm, you can use the following XSD which is supported by a Spring namespace handler and can thus be defined in a spring xml configuration file.
+To override or deploy a new realm, you can use the following XSD which is supported by a Spring namespace handler and can thus be defined in a spring xml configuration file.
 
 Following is the XML Schema to use when defining Karaf realms:
 {pygmentize:xml}
@@ -72,7 +72,7 @@ Here are two example using this schema:
     <!-- Bean to allow the $[karaf.base] property to be correctly resolved -->
     <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
 
-    <jaas:config name="karaf">
+    <jaas:config name="myrealm">
         <jaas:module className="org.apache.karaf.jaas.modules.properties.PropertiesLoginModule" 
                      flags="required">
             users = $[karaf.base]/etc/users.properties
@@ -98,6 +98,31 @@ The content of the {{module}} element is
 
 Deploying such a code will lead to a [JaasRealm|http://svn.apache.org/repos/asf/karaf/tags/karaf-2.0.0/jaas/config/src/main/java/org/apache/karaf/jaas/config/JaasRealm.java] object in the OSGi registry, which will then be used when using the JAAS login module.
 
+h3. Configuration override and use of the {{rank}} attribute
+
+The {{rank}} attribute on the {{config}} element is tied to the ranking of the underlying OSGi service.  When the JAAS framework will perform an authentication, it will use the realm name to find a matching JAAS configuration.  If multiple configurations are used, the one with the highest {{rank}} attribute will be used.
+So if you want to override the default security configuration in Karaf (which is used by the ssh shell, web console and JMX layer), you need to deploy a JAAS configuration with the name {{name="karaf"}} and {{rank="1"}}.
+
+{pygmentize:xml}
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:jaas="http://karaf.apache.org/xmlns/jaas/v1.0.0"
+           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
+
+    <!-- Bean to allow the $[karaf.base] property to be correctly resolved -->
+    <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
+
+    <jaas:config name="karaf" rank="1">
+        <jaas:module className="org.apache.karaf.jaas.modules.properties.PropertiesLoginModule"
+                     flags="required">
+            users = $[karaf.base]/etc/users.properties
+            ...
+        </jaas:module>
+    </jaas:config>
+
+</blueprint>
+{pygmentize}
+
+
 h2. Architecture
 
 Due to constraints in the JAAS specification, one class has to be available for all bundles.  This class is called [ProxyLoginModule|http://svn.apache.org/repos/asf/karaf/tags/karaf-2.0.0/jaas/boot/src/main/java/org/apache/karaf/jaas/boot/ProxyLoginModule.java] and is a LoginModule that acts as a proxy for an OSGi defines LoginModule.  If you plan to integrate this feature into another OSGi runtime, this class must be made available from the system classloader and the related package be part of the boot delegation classpath (or be deployed as a fragment attached to the system bundle).