[jboss-user] [JBoss Seam] - rule based security - hard wired names in ant project

knuwu do-not-reply at jboss.com
Wed Apr 4 08:46:40 EDT 2007


I'm a little bit unhappy with some hard wired dependencies, in case you are using the seam-gen generated ant eclipse project for deploying the application.

If you are looking to the components.xml Konfiguration you might get the feeling, that you are free to name and position your xxx.drl rule file.


  | 	<security:identity authenticate-method="#{authenticator.authenticate}"
  | 		                      security-rules="#{securityRules}" />
  | 
  | 	<drools:rule-base name="securityRules">
  | 		<drools:rule-files>
  | 			<value>/security.drl</value>
  | 		</drools:rule-files>
  | 	</drools:rule-base>
  | 

But if you looking to the ant build.xml you see:


  |        <target name="ear" description="Build the EAR">
  |                 <copy todir="${ear.dir}">
  |                         <fileset dir="${basedir}/resources">
  |                                 <include name="*jpdl.xml" />
  |                                 <include name="hibernate.cfg.xml" />
  |                                 <include name="jbpm.cfg.xml" />
  |                                 <include name="security.drl" />
  |                         </fileset>
  |   ....
  | 

Even worst - if you take a look to class org.jboss.seam.security.RuleBasedIdentity you see:


  |    protected void initSecurityContext()
  |    {
  |       if (securityRules==null)
  |       {
  |          securityRules = (RuleBase) Component.getInstance(RULES_COMPONENT_NAME, true);
  |       }
  |       
  |       if (securityRules != null)
  |       {
  |          securityContext = securityRules.newWorkingMemory(false);
  |       }
  |       
  |       if (securityContext == null)
  |       {
  |          log.warn("no security rule base available - please install a RuleBase with the name '" +
  |                   RULES_COMPONENT_NAME + "' if permission checks are required.");
  |       }
  |    }
  | 

where RULES_COMPONENT_NAME has the value "securityRules" which fixes the name of your rule base.

If you take a look in the manual, you find this example:


  | <drools:rule-base name="securityRules">
  |   <drools:rule-files>
  |     <value>/META-INF/security.drl</value>
  |   </drools:rule-files>
  | </drools:rule-base>
  | 

This simply does not work since the seam-gen generated build.xml ant project only deploys a file called security.drl position in the /resources directory.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034528#4034528

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034528



More information about the jboss-user mailing list