You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by mr...@apache.org on 2016/03/02 22:34:26 UTC

[3/3] usergrid git commit: Add try/catch to handle case when local verification fails.

Add try/catch to handle case when local verification fails.


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/e15cb12a
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/e15cb12a
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/e15cb12a

Branch: refs/heads/release-2.1.1
Commit: e15cb12a3187ce3f373b213f364c6327e9e56818
Parents: 8f588b9
Author: Michael Russo <mi...@gmail.com>
Authored: Tue Feb 16 16:00:59 2016 -0800
Committer: Michael Russo <mr...@apigee.com>
Committed: Wed Mar 2 13:31:09 2016 -0800

----------------------------------------------------------------------
 .../security/tokens/cassandra/TokenServiceImpl.java   | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/e15cb12a/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
index 8792fa8..3f046e2 100644
--- a/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
+++ b/stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
@@ -326,10 +326,16 @@ public class TokenServiceImpl implements TokenService {
             return null;
         }
 
-        TokenInfo tokenInfo = getTokenInfo( uuid );
-
-        if ( tokenInfo == null ) {
-            return isSSOEnabled() ? validateExternalToken( token, maxPersistenceTokenAge ) : null;
+        TokenInfo tokenInfo;
+        try {
+            tokenInfo = getTokenInfo( uuid );
+        } catch (InvalidTokenException e){
+            // now try from central sso
+            if ( isSSOEnabled() ){
+                return validateExternalToken( token, maxPersistenceTokenAge );
+            }else{
+                throw e; // re-throw the error
+            }
         }
 
         //update the token