0 Replies Latest reply on Jun 17, 2008 10:37 AM by Jervis Liu

    Where is RuleBasedIdentity in Seam 2.1

    Jervis Liu Apprentice

      Hi,


      I am trying to upgrade drools-jbrms' dependency on Seam from version 2.0 to 2.1 and have been having some fun with the new security features in Seam 2.1. The doc mentions that I need to use RuleBasedIdentity or extend this class if I want to use Drools based security checks, however this class(RuleBasedIdentity) seems have been removed from trunk. So what is the replacement for RuleBasedIdentity in Seam2.1? Any helps will be appreciated.


      Another question is that I may want to avoid using rule-based checks, but using sth simple instead, e.g., the simplified mode as described by the doc. In this case I need to extend Identity and have a context somewhere to store my own customized permission objects, very similair to what RuleBasedIdentity does in 2.0. Below is a code snippet that works in Seam 2.0


      //same user may have different roles for different packages
      public class PackageBasedPermission {
          private String package;
          private String role;
          
          public String getPackage;() {
              return package;
          }
          public String getRole;() {
              return role;
          }
      }
      
      
      //Assert customized permission object into working memory
      WorkingMemory wm = ((RuleBasedIdentity) Identity.instance()).getSecurityContext();                   
      wm.assertObject(new PackageBasedPermission("package1", "admin"));
      wm.assertObject(new PackageBasedPermission("package2", "guest"));
      



      So the question is if there is any context I can use in Seam to story my customized object similar to the RuleBasedIdentity.getSecurityContext()?


      Thanks,
      Jervis Liu