當前位置: 首頁>>代碼示例>>Java>>正文


Java UserGroupInformation.getAuthenticationMethod方法代碼示例

本文整理匯總了Java中org.apache.hadoop.security.UserGroupInformation.getAuthenticationMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java UserGroupInformation.getAuthenticationMethod方法的具體用法?Java UserGroupInformation.getAuthenticationMethod怎麽用?Java UserGroupInformation.getAuthenticationMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.security.UserGroupInformation的用法示例。


在下文中一共展示了UserGroupInformation.getAuthenticationMethod方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doGet

import org.apache.hadoop.security.UserGroupInformation; //導入方法依賴的package包/類
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
  UserGroupInformation ugi = HttpUserGroupInformation.get();
  if (ugi != null) {
    String ret = "remoteuser=" + req.getRemoteUser() + ":ugi=" +
        ugi.getShortUserName();
    if (ugi.getAuthenticationMethod() ==
        UserGroupInformation.AuthenticationMethod.PROXY) {
      ret = "realugi=" + ugi.getRealUser().getShortUserName() + ":" + ret;
    }
    resp.setStatus(HttpServletResponse.SC_OK);
    resp.getWriter().write(ret);
  } else {
    resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  }
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:18,代碼來源:TestWebDelegationToken.java

示例2: printUGI

import org.apache.hadoop.security.UserGroupInformation; //導入方法依賴的package包/類
private void printUGI(UserGroupInformation ugi) {
  if (ugi != null) {
    // dump login information
    AuthenticationMethod authMethod = ugi.getAuthenticationMethod();
    LOG.info("\n{} \nUser: {} \nAuth method: {} \nKeytab: {} \n",
        new Object[] {
          authMethod.equals(AuthenticationMethod.PROXY) ? "Proxy as: " : "Logged as: ",
          ugi.getUserName(), authMethod, ugi.isFromKeytab()
        }
    );
  }
}
 
開發者ID:moueimei,項目名稱:flume-release-1.7.0,代碼行數:13,代碼來源:KerberosAuthenticator.java

示例3: getConnectionAuthenticationMethod

import org.apache.hadoop.security.UserGroupInformation; //導入方法依賴的package包/類
/**
 * Returns authentication method used to establish the connection
 * @return AuthenticationMethod used to establish connection
 * @throws IOException
 */
private AuthenticationMethod getConnectionAuthenticationMethod()
    throws IOException {
  UserGroupInformation ugi = getRemoteUser();
  AuthenticationMethod authMethod = ugi.getAuthenticationMethod();
  if (authMethod == AuthenticationMethod.PROXY) {
    authMethod = ugi.getRealUser().getAuthenticationMethod();
  }
  return authMethod;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:15,代碼來源:FSNamesystem.java

示例4: isAllowedDelegationTokenOp

import org.apache.hadoop.security.UserGroupInformation; //導入方法依賴的package包/類
/**
 * @param ugi A user group information.
 * @return true if delegation token operation is allowed
 */
private boolean isAllowedDelegationTokenOp(UserGroupInformation ugi) throws IOException {
  AuthenticationMethod authMethod = ugi.getAuthenticationMethod();
  if (authMethod == AuthenticationMethod.PROXY) {
    authMethod = ugi.getRealUser().getAuthenticationMethod();
  }
  if (authMethod != AuthenticationMethod.KERBEROS
      && authMethod != AuthenticationMethod.KERBEROS_SSL
      && authMethod != AuthenticationMethod.CERTIFICATE) {
    return false;
  }
  return true;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:17,代碼來源:TokenProvider.java

示例5: logAuditEvent

import org.apache.hadoop.security.UserGroupInformation; //導入方法依賴的package包/類
@Override
public void logAuditEvent(boolean succeeded, String userName,
    InetAddress addr, String cmd, String src, String dst,
    FileStatus status, UserGroupInformation ugi,
    DelegationTokenSecretManager dtSecretManager) {
  if (auditLog.isInfoEnabled()) {
    final StringBuilder sb = auditBuffer.get();
    sb.setLength(0);
    sb.append("allowed=").append(succeeded).append("\t");
    sb.append("ugi=").append(userName).append("\t");
    sb.append("ip=").append(addr).append("\t");
    sb.append("cmd=").append(cmd).append("\t");
    sb.append("src=").append(src).append("\t");
    sb.append("dst=").append(dst).append("\t");
    if (null == status) {
      sb.append("perm=null");
    } else {
      sb.append("perm=");
      sb.append(status.getOwner()).append(":");
      sb.append(status.getGroup()).append(":");
      sb.append(status.getPermission());
    }
    if (logTokenTrackingId) {
      sb.append("\t").append("trackingId=");
      String trackingId = null;
      if (ugi != null && dtSecretManager != null
          && ugi.getAuthenticationMethod() == AuthenticationMethod.TOKEN) {
        for (TokenIdentifier tid: ugi.getTokenIdentifiers()) {
          if (tid instanceof DelegationTokenIdentifier) {
            DelegationTokenIdentifier dtid =
                (DelegationTokenIdentifier)tid;
            trackingId = dtSecretManager.getTokenTrackingId(dtid);
            break;
          }
        }
      }
      sb.append(trackingId);
    }
    sb.append("\t").append("proto=");
    sb.append(NamenodeWebHdfsMethods.isWebHdfsInvocation() ? "webhdfs" : "rpc");
    logAuditMessage(sb.toString());
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:44,代碼來源:FSNamesystem.java


注:本文中的org.apache.hadoop.security.UserGroupInformation.getAuthenticationMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。