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/02/17 01:01:26 UTC

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

Repository: usergrid
Updated Branches:
  refs/heads/1.x bbc5e1a05 -> 8f360c791


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/8f360c79
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/8f360c79
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/8f360c79

Branch: refs/heads/1.x
Commit: 8f360c79102ba3f1d83617176e529f9992f6882b
Parents: bbc5e1a
Author: Michael Russo <mi...@gmail.com>
Authored: Tue Feb 16 16:00:59 2016 -0800
Committer: Michael Russo <mi...@gmail.com>
Committed: Tue Feb 16 16:00:59 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/8f360c79/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 3e58f24..e222b12 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
@@ -301,10 +301,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