dblevins 2004/02/10 03:06:27
Modified: modules/security/src/java/org/apache/geronimo/security
ContextManager.java
Log:
Modified isCallerInRole and getCallerPrinciple to handle the situation
where the caller is not known, as is the case when the security interceptor
is dissabled.
Revision Changes Path
1.3 +11 -1
incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/ContextManager.java
Index: ContextManager.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/security/src/java/org/apache/geronimo/security/ContextManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ContextManager.java 25 Jan 2004 01:47:09 -0000 1.2
+++ ContextManager.java 10 Feb 2004 11:06:27 -0000 1.3
@@ -145,6 +145,12 @@
SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(GET_CONTEXT);
+ Object caller = currentCaller.get();
+ if (caller == null){
+ return new Principal(){
+ public String getName(){return "";}
+ };
+ }
Context context = (Context) subjectContexts.get(currentCaller.get());
assert context != null : "No registered context";
@@ -177,6 +183,9 @@
if (role == null) throw new IllegalArgumentException("Role must not
be null");
try {
+ Object caller = currentCaller.get();
+ if (caller == null) return false;
+
Context context = (Context)
subjectContexts.get(currentCaller.get());
assert context != null : "No registered context";
@@ -266,4 +275,5 @@
Subject subject;
Principal principal;
}
+
}