diff options
author | Simon Rettberg | 2015-08-27 18:08:48 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-08-27 18:08:48 +0200 |
commit | ac15c2a1cfe0fc0519b5577e7478c25500fe45c3 (patch) | |
tree | cdc93ee180fe17220c8a193fff73238e9ddcc651 /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/SessionManager.java | |
parent | Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff) | |
download | tutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.tar.gz tutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.tar.xz tutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.zip |
[*] Thrift API changes
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/SessionManager.java')
-rw-r--r-- | dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/SessionManager.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/SessionManager.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/SessionManager.java index 48876233..f9175e98 100644 --- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/SessionManager.java +++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/thrift/SessionManager.java @@ -12,8 +12,8 @@ import org.openslx.bwlp.sat.permissions.User; import org.openslx.bwlp.thrift.iface.AuthorizationError; import org.openslx.bwlp.thrift.iface.Role; import org.openslx.bwlp.thrift.iface.TAuthorizationException; -import org.openslx.bwlp.thrift.iface.TInternalServerError; import org.openslx.bwlp.thrift.iface.TInvalidTokenException; +import org.openslx.bwlp.thrift.iface.TInvocationException; import org.openslx.bwlp.thrift.iface.UserInfo; import org.openslx.thrifthelper.ThriftManager; import org.openslx.util.QuickTimer; @@ -71,9 +71,9 @@ public class SessionManager { * @return UserInfo for the matching user * @throws TAuthorizationException if the token is not known or the session * expired - * @throws TInternalServerError + * @throws TInvocationException */ - public static UserInfo getOrFail(String token) throws TAuthorizationException, TInternalServerError { + public static UserInfo getOrFail(String token) throws TAuthorizationException, TInvocationException { UserInfo ui = getInternal(token); if (ui != null) return ui; @@ -87,9 +87,9 @@ public class SessionManager { * * @param token Token in question * @throws TAuthorizationException - * @throws TInternalServerError + * @throws TInvocationException */ - public static void ensureAuthenticated(String token) throws TAuthorizationException, TInternalServerError { + public static void ensureAuthenticated(String token) throws TAuthorizationException, TInvocationException { getInternal(token); } @@ -103,12 +103,12 @@ public class SessionManager { public static UserInfo get(String token) { try { return getInternal(token); - } catch (TAuthorizationException | TInternalServerError e) { + } catch (TAuthorizationException | TInvocationException e) { return null; } } - private static UserInfo getInternal(String token) throws TAuthorizationException, TInternalServerError { + private static UserInfo getInternal(String token) throws TAuthorizationException, TInvocationException { Entry e = tokenManager.get(token); if (e == null) { LOGGER.info("Cache miss for token " + token + ", asking master"); @@ -140,9 +140,9 @@ public class SessionManager { * @return * @throws TAuthorizationException if user is not allowed to use this * satellite, this exception contains the reason - * @throws TInternalServerError if something unexpected fails + * @throws TInvocationException if something unexpected fails */ - private static UserInfo getRemote(String token) throws TAuthorizationException, TInternalServerError { + private static UserInfo getRemote(String token) throws TAuthorizationException, TInvocationException { UserInfo ui = null; try { ui = ThriftManager.getMasterClient().getUserFromToken(token); @@ -153,7 +153,7 @@ public class SessionManager { } catch (Exception e) { LOGGER.warn("Could not reach master server to query for user token (" + token + ") of a client!", e); - throw new TInternalServerError(); + throw new TInvocationException(); } LOGGER.info("Got user " + ui.userId + " for token " + token); // TODO XXX HACK: Remove this once master server supplies role @@ -194,7 +194,7 @@ public class SessionManager { DbUser.writeUserOnLogin(ui); } catch (SQLException e) { LOGGER.info("User " + ui.userId + " cannot be written to DB - rejecting."); - throw new TInternalServerError(); + throw new TInvocationException(); } } tokenManager.put(token, new Entry(ui)); |