Examples of AuthenticatedURL


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

    final URL url = toUrl(op, fspath, parameters);

    //connect and get response
    final HttpURLConnection conn;
    try {
      conn = new AuthenticatedURL(AUTH).openConnection(url, authToken);
    } catch(AuthenticationException e) {
      throw new IOException("Authentication failed, url=" + url, e);
    }
    try {
      conn.setRequestMethod(op.getType().toString());
View Full Code Here

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

        }

        if (!currentToken.isSet()) {
            Authenticator authenticator = getAuthenticator();
            try {
                new AuthenticatedURL(authenticator).openConnection(url, currentToken);
            }
            catch (AuthenticationException ex) {
                AUTH_TOKEN_CACHE_FILE.delete();
                throw new OozieClientException(OozieClientException.AUTHENTICATION,
                                               "Could not authenticate, " + ex.getMessage(), ex);
View Full Code Here

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

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

      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

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

      if (LOG.isDebugEnabled()) {
        LOG.debug("open AuthenticatedURL connection" + url);
      }
      UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
      final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token();
      return new AuthenticatedURL(AUTH, connConfigurator).openConnection(url,
          authToken);
    } else {
      if (LOG.isDebugEnabled()) {
        LOG.debug("open URL connection");
      }
View Full Code Here

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

      DelegationTokenOperation.GETDELEGATIONTOKEN;
    Map<String, String> params = new HashMap<String, String>();
    params.put(OP_PARAM, op.toString());
    params.put(RENEWER_PARAM,renewer);
    URL url = HttpFSUtils.createURL(new Path(fsURI), params);
    AuthenticatedURL aUrl =
      new AuthenticatedURL(new HttpFSKerberosAuthenticator());
    try {
      HttpURLConnection conn = aUrl.openConnection(url, token);
      conn.setRequestMethod(op.getHttpMethod());
      HttpFSUtils.validateResponse(conn, HttpURLConnection.HTTP_OK);
      JSONObject json = (JSONObject) ((JSONObject)
        HttpFSUtils.jsonParse(conn)).get(DELEGATION_TOKEN_JSON);
      String tokenStr = (String)
View Full Code Here

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

    Map<String, String> params = new HashMap<String, String>();
    params.put(OP_PARAM,
               DelegationTokenOperation.RENEWDELEGATIONTOKEN.toString());
    params.put(TOKEN_PARAM, dToken.encodeToUrlString());
    URL url = HttpFSUtils.createURL(new Path(fsURI), params);
    AuthenticatedURL aUrl =
      new AuthenticatedURL(new HttpFSKerberosAuthenticator());
    try {
      HttpURLConnection conn = aUrl.openConnection(url, token);
      conn.setRequestMethod(
        DelegationTokenOperation.RENEWDELEGATIONTOKEN.getHttpMethod());
      HttpFSUtils.validateResponse(conn, HttpURLConnection.HTTP_OK);
      JSONObject json = (JSONObject) ((JSONObject)
        HttpFSUtils.jsonParse(conn)).get(DELEGATION_TOKEN_JSON);
View Full Code Here

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

    Map<String, String> params = new HashMap<String, String>();
    params.put(OP_PARAM,
               DelegationTokenOperation.CANCELDELEGATIONTOKEN.toString());
    params.put(TOKEN_PARAM, dToken.encodeToUrlString());
    URL url = HttpFSUtils.createURL(new Path(fsURI), params);
    AuthenticatedURL aUrl =
      new AuthenticatedURL(new HttpFSKerberosAuthenticator());
    try {
      HttpURLConnection conn = aUrl.openConnection(url, token);
      conn.setRequestMethod(
        DelegationTokenOperation.CANCELDELEGATIONTOKEN.getHttpMethod());
      HttpFSUtils.validateResponse(conn, HttpURLConnection.HTTP_OK);
    } catch (AuthenticationException ex) {
      throw new IOException(ex.toString(), ex);
View Full Code Here

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

    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

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

        System.err.println("Usage: <URL>");
        System.exit(-1);
      }
      AuthenticatedURL.Token token = new AuthenticatedURL.Token();
      URL url = new URL(args[0]);
      HttpURLConnection conn = new AuthenticatedURL().openConnection(url, token);
      System.out.println();
      System.out.println("Token value: " + token);
      System.out.println("Status code: " + conn.getResponseCode() + " " + conn.getResponseMessage());
      System.out.println();
      if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.