Exemplo n.º 1
0
 @Override
 public AuthContext login() {
   super.login();
   try {
     client.login();
   } catch (SocketTimeoutException ste) {
     throw new AuthTimeoutException(ste);
   } catch (ConnectTimeoutException cte) {
     throw new AuthTimeoutException(cte);
   } catch (InterruptedIOException ie) {
     throw new AuthInterruptedException(ie);
   } catch (SwiftAuthClientException se) {
     throw new AuthException(se.getMessage(), se);
   } catch (Exception e) {
     throw new AuthException(e);
   }
   return createContext();
 }
Exemplo n.º 2
0
  @Override
  public void init(Config config, Logger logger) {
    super.init(config, logger);

    url = config.get(AUTH_URL_KEY, config.get(AUTH_URL_KEY_BACK, URL_DEFAULT));

    username = config.get(AUTH_USERNAME_KEY, AUTH_USERNAME_DEFAULT);
    password = config.get(AUTH_PASSWORD_KEY, AUTH_PASSWORD_DEFAULT);
    timeout = config.getInt(CONN_TIMEOUT_KEY, CONN_TIMEOUT_DEFAULT);

    parms.put(AUTH_URL_KEY, url);
    parms.put(AUTH_USERNAME_KEY, username);
    parms.put(AUTH_PASSWORD_KEY, password);
    parms.put(CONN_TIMEOUT_KEY, timeout);

    logger.debug("using auth config: {}", parms);

    HttpClient httpClient = HttpClientUtil.createHttpClient(timeout);
    client = new SwiftAuthClient(httpClient, url, username, password);
    logger.debug("swauth client has been initialized");
  }
Exemplo n.º 3
0
 @Override
 public void dispose() {
   super.dispose();
   client.dispose();
 }