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

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


      try {
        if (op.getRequireAuth()) {
          LOG.debug("open AuthenticatedURL connection");
          UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
          final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token();
          conn = new AuthenticatedURL(AUTH, CONN_CONFIGURATOR).openConnection(
            url, authToken);
          URLUtils.setTimeouts(conn);
        } else {
          LOG.debug("open URL connection");
          conn = (HttpURLConnection)URLUtils.openConnection(url);
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

      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

      DelegationTokenOperation.GETDELEGATIONTOKEN;
    Map<String, String> params = new HashMap<String, String>();
    params.put(OP_PARAM, op.toString());
    params.put(RENEWER_PARAM,renewer);
    URL url = HttpFSUtils.createHttpURL(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

    Map<String, String> params = new HashMap<String, String>();
    params.put(OP_PARAM,
               DelegationTokenOperation.RENEWDELEGATIONTOKEN.toString());
    params.put(TOKEN_PARAM, dToken.encodeToUrlString());
    URL url = HttpFSUtils.createHttpURL(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

    Map<String, String> params = new HashMap<String, String>();
    params.put(OP_PARAM,
               DelegationTokenOperation.CANCELDELEGATIONTOKEN.toString());
    params.put(TOKEN_PARAM, dToken.encodeToUrlString());
    URL url = HttpFSUtils.createHttpURL(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

      try {
        if (op.getRequireAuth()) {
          LOG.debug("open AuthenticatedURL connection");
          UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
          final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token();
          conn = new AuthenticatedURL(AUTH, CONN_CONFIGURATOR).openConnection(
            url, authToken);
          URLUtils.setTimeouts(conn);
        } else {
          LOG.debug("open URL connection");
          conn = (HttpURLConnection)URLUtils.openConnection(url);
View Full Code Here

      URL clientUrl = new URL( urlStr );
      //System.out.println( "Resolved query: " + clientUrl );
      AuthenticatedURL.Token token = new AuthenticatedURL.Token();
      KerberosAuthenticator authenticator = new KerberosAuthenticator();
      auditor.audit( Action.DISPATCH, urlStr, ResourceType.URI, ActionOutcome.UNAVAILABLE );
      HttpURLConnection conn = new AuthenticatedURL( authenticator ).openConnection( clientUrl, token );
      //System.out.println( "STATUS=" + conn.getResponseCode() );
      InputStream input = conn.getInputStream();
      if( input != null ) {
        OutputStream output = response.getOutputStream();
        try {
View Full Code Here

      return url.openConnection();
    }

    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

  private HttpURLConnection getHttpUrlConnection(URL url)
      throws IOException {
    final HttpURLConnection conn;
    try {
      if (ugi.hasKerberosCredentials()) {
        conn = new AuthenticatedURL(AUTH).openConnection(url, authToken);
      } else {
        conn = (HttpURLConnection)url.openConnection();
      }
    } catch (AuthenticationException e) {
      throw new IOException("Authentication failed, url=" + 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.