code: @Remoted
      public IPromise<Object[]> login(String user, String pw, String jwt) {
          Promise res = new Promise();
          ConnectionRegistry remoteConnection = connection.get();
          getCredentials(user,pw,jwt).then( (authres, err) -> {
              if ( err != null ) {
                  res.reject(err);
              } else {
                  String sessionId = remoteConnection != null ? remoteConnection.getSocketRef().getConnectionIdentifier() : null;
                  getSession(user,sessionId, authres ).then( (sess,serr) -> {
                      if ( sess != null ) {
                          if ( sessionId != null && sessionStorage != null ) {
                              sessionStorage.putUserAtSessionId(sessionId,user);
                          }
                          res.resolve(new Object[]{sess,authres});
                      } else
                          res.complete(sess,serr);
                  });
              }
          });
          return res;
      }
docs: returns an array of [session actorproxy, userdata]
  @param user
  @param pw
  @param jwt
  @return array [session actor proxy, authenticationresult]