geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/security/util ContextManager.java
Date Sun, 23 Nov 2003 17:43:01 GMT
adc         2003/11/23 09:43:01

  Modified:    modules/core/src/java/org/apache/geronimo/security/util
                        ContextManager.java
  Log:
  Static for WebRoleRefPermission checks (IsUserInRole)
  
  Revision  Changes    Path
  1.3       +11 -1     incubator-geronimo/modules/core/src/java/org/apache/geronimo/security/util/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/security/util/ContextManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContextManager.java	12 Nov 2003 04:29:04 -0000	1.2
  +++ ContextManager.java	23 Nov 2003 17:43:01 -0000	1.3
  @@ -59,6 +59,7 @@
   import org.apache.geronimo.security.RealmPrincipal;
   
   import javax.security.jacc.EJBRoleRefPermission;
  +import javax.security.jacc.WebRoleRefPermission;
   import javax.security.auth.Subject;
   import java.util.Stack;
   import java.util.Hashtable;
  @@ -145,6 +146,15 @@
       public static boolean isCallerInRole(String EJBName, String role) {
           try {
               contexts.peek().context.checkPermission(new EJBRoleRefPermission(EJBName, role));
  +        } catch (AccessControlException e) {
  +            return false;
  +        }
  +        return true;
  +    }
  +
  +    public static boolean isUserInRole(String resourceName, String role) {
  +        try {
  +            contexts.peek().context.checkPermission(new WebRoleRefPermission(resourceName,
role));
           } catch (AccessControlException e) {
               return false;
           }
  
  
  

Mime
View raw message