shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kao...@apache.org
Subject svn commit: r925410 - /incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/remoting/SecureRemoteInvocationFactory.java
Date Fri, 19 Mar 2010 20:37:45 GMT
Author: kaosko
Date: Fri Mar 19 20:37:44 2010
New Revision: 925410

URL: http://svn.apache.org/viewvc?rev=925410&view=rev
Log:
IN PROGRESS - issue SHIRO-89: Sample Spring Application - WebStart won't launch 
http://issues.apache.org/jira/browse/SHIRO-89
- when creating a remote invocation, try to obtain a singleton securityManager to find the
session id but catch the exception and ignore if not set

Modified:
    incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/remoting/SecureRemoteInvocationFactory.java

Modified: incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/remoting/SecureRemoteInvocationFactory.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/remoting/SecureRemoteInvocationFactory.java?rev=925410&r1=925409&r2=925410&view=diff
==============================================================================
--- incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/remoting/SecureRemoteInvocationFactory.java
(original)
+++ incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/remoting/SecureRemoteInvocationFactory.java
Fri Mar 19 20:37:44 2010
@@ -77,14 +77,21 @@ public class SecureRemoteInvocationFacto
         }
 
         //tried the delegate.  If sessionId is still null, only then try the Subject:
-        if (sessionId == null && !sessionManagerMethodInvocation) {
-            Subject subject = SecurityUtils.getSubject();
-            Session session = subject.getSession(false);
-            if (session != null) {
-                sessionId = session.getId();
-                host = session.getHost();
+        try {
+            // HACK Check if can get the securityManager - this'll cause an exception if
it's not set 
+            SecurityUtils.getSecurityManager();
+            if (sessionId == null && !sessionManagerMethodInvocation) {
+                Subject subject = SecurityUtils.getSubject();
+                Session session = subject.getSession(false);
+                if (session != null) {
+                    sessionId = session.getId();
+                    host = session.getHost();
+                }
             }
         }
+        catch (Exception e) {
+            log.trace("No security manager set. Trying next to get session id from system
property");
+        }
 
         //No call to the sessionManager, and the Subject doesn't have a session.  Try a system
property
         //as a last result:



Mime
View raw message