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

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


    try {
      if (requireAuth) {
        LOG.debug("open AuthenticatedURL connection");
        UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
        final AuthenticatedURL.Token authToken = new AuthenticatedURL.Token();
        conn = new AuthenticatedURL(AUTH).openConnection(url, authToken);
      } else {
        LOG.debug("open URL connection");
        conn = (HttpURLConnection)url.openConnection();
      }
    } catch (AuthenticationException e) {
View Full Code Here


    try {
      URL clientUrl = new URL( targetUri.toString() + paramStr.toString() );
      //System.out.println( "Resolved query: " + clientUrl );
      AuthenticatedURL.Token token = new AuthenticatedURL.Token();
      KerberosAuthenticator authenticator = new KerberosAuthenticator();
      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

  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

    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

  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

  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

  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

        }

        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

    private static HttpURLConnection getConnection(URL url) throws IOException {
        AuthenticatedURL.Token token = new AuthenticatedURL.Token();
        HttpURLConnection conn;
        try {
            conn = new AuthenticatedURL(AuthenticatorClass.newInstance()).openConnection(url, token);
        }
        catch (AuthenticationException ex) {
            throw new IOException("Could not authenticate, " + ex.getMessage(), ex);
        }
        catch (InstantiationException ex) {
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

TOP

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

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.