Package org.apache.hadoop.security.authentication.client

Examples of org.apache.hadoop.security.authentication.client.AuthenticatedURL


  private HttpURLConnection getHttpUrlConnection(URL url)
      throws IOException, AuthenticationException {
    final HttpURLConnection conn;
    if (ugi.hasKerberosCredentials()) {
      conn = new AuthenticatedURL(AUTH).openConnection(url, authToken);
    } else {
      conn = (HttpURLConnection)url.openConnection();
    }
    return conn;
  }
View Full Code Here


            URL url = new URL(baseUrl + AUTH_URL);
            // using KerberosAuthenticator which falls back to PsuedoAuthenticator
            // instead of passing authentication type from the command line - bad factory
            HttpsURLConnection.setDefaultSSLSocketFactory(getSslContext().getSocketFactory());
            HttpsURLConnection.setDefaultHostnameVerifier(ALL_TRUSTING_HOSTNAME_VERIFIER);
            new AuthenticatedURL(AUTHENTICATOR).openConnection(url, currentToken);
        } catch (Exception ex) {
            throw new FalconCLIException("Could not authenticate, " + ex.getMessage(), ex);
        }

        return currentToken;
View Full Code Here

        TimelineDelegationTokenOperation.GETDELEGATIONTOKEN;
    Map<String, String> params = new HashMap<String, String>();
    params.put(TimelineAuthenticationConsts.OP_PARAM, op.toString());
    params.put(TimelineAuthenticationConsts.RENEWER_PARAM, renewer);
    url = appendParams(url, params);
    AuthenticatedURL aUrl =
        new AuthenticatedURL(new TimelineAuthenticator());
    try {
      HttpURLConnection conn = aUrl.openConnection(url, token);
      conn.setRequestMethod(op.getHttpMethod());
      TimelineDelegationTokenResponse dtRes = validateAndParseResponse(conn);
      if (!dtRes.getType().equals(
          TimelineAuthenticationConsts.DELEGATION_TOKEN_URL)) {
        throw new IOException("The response content is not expected: "
View Full Code Here

    params.put(TimelineAuthenticationConsts.OP_PARAM,
        TimelineDelegationTokenOperation.RENEWDELEGATIONTOKEN.toString());
    params.put(TimelineAuthenticationConsts.TOKEN_PARAM,
        dToken.encodeToUrlString());
    url = appendParams(url, params);
    AuthenticatedURL aUrl =
        new AuthenticatedURL(new TimelineAuthenticator());
    try {
      HttpURLConnection conn = aUrl.openConnection(url, token);
      conn.setRequestMethod(
          TimelineDelegationTokenOperation.RENEWDELEGATIONTOKEN.getHttpMethod());
      TimelineDelegationTokenResponse dtRes = validateAndParseResponse(conn);
      if (!dtRes.getType().equals(
          TimelineAuthenticationConsts.DELEGATION_TOKEN_EXPIRATION_TIME)) {
View Full Code Here

    params.put(TimelineAuthenticationConsts.OP_PARAM,
        TimelineDelegationTokenOperation.CANCELDELEGATIONTOKEN.toString());
    params.put(TimelineAuthenticationConsts.TOKEN_PARAM,
        dToken.encodeToUrlString());
    url = appendParams(url, params);
    AuthenticatedURL aUrl =
        new AuthenticatedURL(new TimelineAuthenticator());
    try {
      HttpURLConnection conn = aUrl.openConnection(url, token);
      conn.setRequestMethod(TimelineDelegationTokenOperation.CANCELDELEGATIONTOKEN
          .getHttpMethod());
      validateAndParseResponse(conn);
    } catch (AuthenticationException ex) {
      throw new IOException(ex.toString(), ex);
View Full Code Here

    Class<? extends Authenticator> klass =
      getConf().getClass("httpfs.authenticator.class",
                         HttpFSKerberosAuthenticator.class, Authenticator.class);
    Authenticator authenticator = ReflectionUtils.newInstance(klass, getConf());
    try {
      HttpURLConnection conn = new AuthenticatedURL(authenticator).openConnection(url, authToken);
      conn.setRequestMethod(method);
      if (method.equals(HTTP_POST) || method.equals(HTTP_PUT)) {
        conn.setDoOutput(true);
      }
      return conn;
View Full Code Here

          url = TimelineAuthenticator.appendParams(url, params);
          if (LOG.isDebugEnabled()) {
            LOG.debug("URL with delegation token: " + url);
          }
        }
        return new AuthenticatedURL(authenticator).openConnection(url, token);
      } catch (AuthenticationException e) {
        LOG.error("Authentication failed when openning connection [" + url
            + "] with token [" + token + "].", e);
        throw new IOException(e);
      }
View Full Code Here

    Class<? extends Authenticator> klass =
      getConf().getClass("httpfs.authenticator.class",
                         HttpFSKerberosAuthenticator.class, Authenticator.class);
    Authenticator authenticator = ReflectionUtils.newInstance(klass, getConf());
    try {
      HttpURLConnection conn = new AuthenticatedURL(authenticator).openConnection(url, authToken);
      conn.setRequestMethod(method);
      if (method.equals(HTTP_POST) || method.equals(HTTP_PUT)) {
        conn.setDoOutput(true);
      }
      return conn;
View Full Code Here

    if (!UserGroupInformation.isSecurityEnabled() || useKsslAuth) {
      return url.openConnection();
    } else {
      AuthenticatedURL.Token token = new AuthenticatedURL.Token();
      try {
        return new AuthenticatedURL().openConnection(url, token);
      } catch (AuthenticationException e) {
        throw new IOException("Exception trying to open authenticated connection to "
            + url, e);
      }
    }
View Full Code Here

      return url.openConnection();
    }

    AuthenticatedURL.Token token = new AuthenticatedURL.Token();
    try {
      return new AuthenticatedURL(null, sslFactory).openConnection(url, token);
    } catch (AuthenticationException e) {
      throw new IOException("Exception trying to open authenticated connection to "
              + url, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.security.authentication.client.AuthenticatedURL

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.