...
But still, an effort required to configure login modules into GenericSecurityRealm
with the list of LoginModuleUse
GBeans may seem excessive. To help with this kind of problems GBean definition syntax allows for syntactic sugar in the form of xml-reference element. At this point it is necessary to emphasize that this is just a syntactic sugar reference that gets processed at the deployment time to create and wire up all GBeans that otherwise would have been explicitly defined. We will show the use of xml-reference in the GenericSecurityRealm
configuration later.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<GBean name="geronimo-properties-realm" class="org.apache.geronimo.security.realm.GenericSecurityRealm"> <!-- security-realm name; this is a name of the Security Realm as well as the name of -- the configuration entry used by the application --> <attribute name="realmName">geronimo-properties-realm</attribute> <!-- reference to the head of the login module use list --> <reference name="LoginModuleConfiguration"> <name>properties-login</name> </reference> <!-- server-info reference is passed to most GBeans --> <reference name="ServerInfo"> <module>org/apache/geronimo/System</module><name>ServerInfo</name> </reference> <!-- reference to the login-service GBean --> <reference name="LoginService"><name>JaasLoginService</name></reference> </GBean> <!-- this is the head of the login-module-use list --> <GBean name="properties-login" class="org.apache.geronimo.security.jaas.JaasLoginModuleUse"> <!-- login module must succeed --> <attribute name="controlFlag">REQUIRED</attribute> <!-- reference to the login module --> <reference name="LoginModule"> <name>properties-login</name> </reference> </GBean> <!-- this is login module GBean --> <GBean name="properties-login" class="org.apache.geronimo.security.jaas.LoginModuleGBean"> <attribute name="loginModuleClass"> org.apache.geronimo.security.realm.providers.PropertiesFileLoginModule </attribute> <attribute name="serverSide">true</attribute> <!-- login module specific options --> <attribute name="options"> usersURI=var/security/users.properties <!-- user database --> groupsURI=var/security/groups.properties <!-- group database --> </attribute> <attribute name="loginDomainName">geronimo-properties</attribute> </GBean> |
It does not look too bad here, in this example but imagine that you have 2 login modules in the Security Realm and how many GBean dependencies you have to configure.
Note that the order in which all these elements are defined does not matter. If you look at the deployment plans, you 'll will find that login-module GBeans are defined first (as they represent elements of reuse by the GenericSecurityRealm
GBeans). GenericSecurityRealm
GBeans and JaasLoginModuleUse
GBeans are normally close to each other.
...