Ejemplo n.º 1
0
 public ResultsFuture<?> logoff() throws InvalidSessionException {
   DQPWorkContext workContext = DQPWorkContext.getWorkContext();
   this.service.closeSession(workContext.getSessionId());
   workContext.getSession().setSessionId(null);
   workContext.getSession().getSessionVariables().clear();
   return ResultsFuture.NULL_FUTURE;
 }
Ejemplo n.º 2
0
  private String updateDQPContext(SessionMetadata s) {
    String sessionID = s.getSessionId();

    DQPWorkContext workContext = DQPWorkContext.getWorkContext();
    workContext.setSession(s);
    return sessionID;
  }
Ejemplo n.º 3
0
 public ResultsFuture<?> ping() throws InvalidSessionException, TeiidComponentException {
   // ping is double used to alert the aliveness of the client, as well as check the server
   // instance is
   // alive by socket server instance, so that they can be cached.
   String id = DQPWorkContext.getWorkContext().getSessionId();
   if (id != null) {
     this.service.pingServer(id);
   }
   LogManager.logTrace(LogConstants.CTX_SECURITY, "Ping", id); // $NON-NLS-1$
   return ResultsFuture.NULL_FUTURE;
 }
Ejemplo n.º 4
0
  private LogonResult logon(Properties connProps, byte[] krb5ServiceTicket) throws LogonException {
    // DQPWorkContext workContext = DQPWorkContext.getWorkContext();
    // String oldSessionId = workContext.getSessionId();
    String applicationName = connProps.getProperty(TeiidURL.CONNECTION.APP_NAME);
    // user may be null if using trustedToken to log on
    String user =
        connProps.getProperty(TeiidURL.CONNECTION.USER_NAME, CoreConstants.DEFAULT_ANON_USERNAME);
    // password may be null if using trustedToken to log on
    String password = connProps.getProperty(TeiidURL.CONNECTION.PASSWORD);
    Credentials credential = null;
    if (password != null) {
      credential = new Credentials(password.toCharArray());
    }

    try {
      SessionMetadata sessionInfo =
          service.createSession(user, credential, applicationName, connProps, true);
      updateDQPContext(sessionInfo);
      if (DQPWorkContext.getWorkContext().getClientAddress() == null) {
        sessionInfo.setEmbedded(true);
      }
      // if (oldSessionId != null) {
      // TODO: we should be smarter about disassociating the old sessions from the client.  we'll
      // just rely on
      // ping based clean up
      // }
      LogonResult result =
          new LogonResult(
              sessionInfo.getSessionToken(),
              sessionInfo.getVDBName(),
              sessionInfo.getVDBVersion(),
              clusterName);
      if (krb5ServiceTicket != null) {
        result.addProperty(ILogon.KRB5TOKEN, krb5ServiceTicket);
      }
      return result;
    } catch (LoginException e) {
      throw new LogonException(e);
    } catch (SessionServiceException e) {
      throw new LogonException(e);
    }
  }