Package org.teiid.client.security

Examples of org.teiid.client.security.SessionToken


  }

  public LogonResult logon(Properties connProps) throws LogonException,
      ComponentNotFoundException {
    DQPWorkContext workContext = DQPWorkContext.getWorkContext();
    SessionToken oldToken = workContext.getSessionToken();
        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());
        }
       
        boolean adminConnection = Boolean.parseBoolean(connProps.getProperty(TeiidURL.CONNECTION.ADMIN));
    try {
      SessionMetadata sessionInfo = service.createSession(user,credential, applicationName, connProps, adminConnection, true);
          updateDQPContext(sessionInfo);
          if (DQPWorkContext.getWorkContext().getClientAddress() == null) {
        sessionInfo.setEmbedded(true);
          }
          if (oldToken != null) {
            try {
          this.service.closeSession(oldToken.getSessionID());
        } catch (InvalidSessionException e) {
        }
          }
      return new LogonResult(sessionInfo.getSessionToken(), sessionInfo.getVDBName(), sessionInfo.getVDBVersion(), clusterName);
    } catch (LoginException e) {
View Full Code Here


   
    if (sessionInfo == null) {
      throw new InvalidSessionException();
    }
   
    SessionToken st = sessionInfo.getSessionToken();
    if (!st.equals(checkSession)) {
      throw new InvalidSessionException();
    }
    this.updateDQPContext(sessionInfo);
  }
View Full Code Here

       
        long creationTime = System.currentTimeMillis();

        // Return a new session info object
        SessionMetadata newSession = new SessionMetadata();
        newSession.setSessionToken(new SessionToken(userName));
        newSession.setSessionId(newSession.getSessionToken().getSessionID());
        newSession.setUserName(userName);
        newSession.setCreatedTime(creationTime);
        newSession.setApplicationName(applicationName);
        newSession.setClientHostName(properties.getProperty(TeiidURL.CONNECTION.CLIENT_HOSTNAME));
View Full Code Here

      ClientServiceRegistryImpl server = new ClientServiceRegistryImpl();
      server.registerClientService(ILogon.class, new LogonImpl(mock(SessionService.class), "fakeCluster") { //$NON-NLS-1$
        @Override
        public LogonResult logon(Properties connProps)
            throws LogonException, ComponentNotFoundException {
          return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
        }
       
        @Override
        public ResultsFuture<?> ping() throws InvalidSessionException,
            TeiidComponentException {
View Full Code Here

    SessionMetadata session = new SessionMetadata();
    session.setUserName(userName);
    session.setApplicationName(applicationName);
    session.setSessionId(String.valueOf(1));
    session.setSessionToken(new SessionToken(1, userName));

    Mockito.stub(ssi.createSession(userName, null, applicationName,p, false, true)).toReturn(session);

    LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$
View Full Code Here

    server.registerClientService(ILogon.class, new LogonImpl(mock(SessionService.class), "fakeCluster") { //$NON-NLS-1$
      @Override
      public LogonResult logon(Properties connProps)
          throws LogonException, ComponentNotFoundException {
        logonAttempts++;
        return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
      }
     
      @Override
      public ResultsFuture<?> ping() throws InvalidSessionException,
          TeiidComponentException {
View Full Code Here

    @Override
    public LogonResult logon(
        Properties connectionProperties)
        throws LogonException,
        TeiidComponentException {
      return new LogonResult(new SessionToken(1, connectionProperties.getProperty(TeiidURL.CONNECTION.USER_NAME, "fooUser")), "foo", 1, "fake"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }
View Full Code Here

      stub(mock.getService(DQP.class)).toReturn(dqp);
      Properties props = new Properties();
      props.setProperty(BaseDataSource.VDB_NAME, STD_DATABASE_NAME);
      props.setProperty(BaseDataSource.VDB_VERSION, String.valueOf(STD_DATABASE_VERSION));
      props.setProperty(BaseDataSource.USER_NAME, "metamatrixadmin"); //$NON-NLS-1$
      stub(mock.getLogonResult()).toReturn(new LogonResult(new SessionToken(1, "metamatrixadmin"), STD_DATABASE_NAME,STD_DATABASE_VERSION , "fake")); //$NON-NLS-1$
      return new ConnectionImpl(mock, props, serverUrl);
    }
View Full Code Here

TOP

Related Classes of org.teiid.client.security.SessionToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.