예제 #1
0
 private void authorise(
     final JsonObject message, final String sessionID, final AsyncResultHandler<Boolean> handler) {
   // If session id is in local cache we'll consider them authorised
   final AsyncResult<Boolean> res = new AsyncResult<>();
   if (authCache.containsKey(sessionID)) {
     res.setResult(true).setHandler(handler);
   } else {
     eb.send(
         authAddress,
         message,
         new Handler<Message<JsonObject>>() {
           public void handle(Message<JsonObject> reply) {
             boolean authed = reply.body.getString("status").equals("ok");
             res.setResult(authed).setHandler(handler);
           }
         });
   }
 }