Tabnine Logo
HBaseTokenUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
HBaseTokenUtils
in
co.cask.cdap.data.security

Best Java code snippets using co.cask.cdap.data.security.HBaseTokenUtils (Showing top 4 results out of 315)

origin: cdapio/cdap

/**
 * Gets a HBase delegation token and stores it in the given Credentials.
 *
 * @return the same Credentials instance as the one given in parameter.
 */
public static Credentials obtainToken(Configuration hConf, Credentials credentials) {
 if (!User.isHBaseSecurityEnabled(hConf)) {
  return credentials;
 }
 try {
  Class c = Class.forName("org.apache.hadoop.hbase.security.token.TokenUtil");
  Method method = c.getMethod("obtainToken", Configuration.class);
  Token<? extends TokenIdentifier> token = castToken(method.invoke(null, hConf));
  credentials.addToken(token.getService(), token);
  return credentials;
 } catch (Exception e) {
  throw Throwables.propagate(e);
 }
}
origin: cdapio/cdap

/**
 * Creates a {@link Credentials} that contains delegation tokens of the current user for all services that CDAP uses.
 */
public Credentials createCredentials() {
 try {
  Credentials refreshedCredentials = new Credentials();
  if (User.isSecurityEnabled()) {
   YarnTokenUtils.obtainToken(yarnConf, refreshedCredentials);
  }
  if (User.isHBaseSecurityEnabled(yarnConf)) {
   HBaseTokenUtils.obtainToken(yarnConf, refreshedCredentials);
  }
  if (secureExplore) {
   HiveTokenUtils.obtainTokens(cConf, refreshedCredentials);
   JobHistoryServerTokenUtils.obtainToken(yarnConf, refreshedCredentials);
  }
  if (secureStore instanceof DelegationTokensUpdater) {
   String renewer = UserGroupInformation.getCurrentUser().getShortUserName();
   ((DelegationTokensUpdater) secureStore).addDelegationTokens(renewer, refreshedCredentials);
  }
  YarnUtils.addDelegationTokens(yarnConf, locationFactory, refreshedCredentials);
  return refreshedCredentials;
 } catch (IOException ioe) {
  throw Throwables.propagate(ioe);
 }
}
origin: co.cask.cdap/cdap-app-fabric

/**
 * Creates a {@link Credentials} that contains delegation tokens of the current user for all services that CDAP uses.
 */
public Credentials createCredentials() {
 try {
  Credentials refreshedCredentials = new Credentials();
  if (User.isSecurityEnabled()) {
   YarnTokenUtils.obtainToken(yarnConf, refreshedCredentials);
  }
  if (User.isHBaseSecurityEnabled(yarnConf)) {
   HBaseTokenUtils.obtainToken(yarnConf, refreshedCredentials);
  }
  if (secureExplore) {
   HiveTokenUtils.obtainTokens(cConf, refreshedCredentials);
   JobHistoryServerTokenUtils.obtainToken(yarnConf, refreshedCredentials);
  }
  if (secureStore instanceof DelegationTokensUpdater) {
   String renewer = UserGroupInformation.getCurrentUser().getShortUserName();
   ((DelegationTokensUpdater) secureStore).addDelegationTokens(renewer, refreshedCredentials);
  }
  YarnUtils.addDelegationTokens(yarnConf, locationFactory, refreshedCredentials);
  return refreshedCredentials;
 } catch (IOException ioe) {
  throw Throwables.propagate(ioe);
 }
}
origin: co.cask.cdap/cdap-data-fabric

/**
 * Gets a HBase delegation token and stores it in the given Credentials.
 *
 * @return the same Credentials instance as the one given in parameter.
 */
public static Credentials obtainToken(Configuration hConf, Credentials credentials) {
 if (!User.isHBaseSecurityEnabled(hConf)) {
  return credentials;
 }
 try {
  Class c = Class.forName("org.apache.hadoop.hbase.security.token.TokenUtil");
  Method method = c.getMethod("obtainToken", Configuration.class);
  Token<? extends TokenIdentifier> token = castToken(method.invoke(null, hConf));
  credentials.addToken(token.getService(), token);
  return credentials;
 } catch (Exception e) {
  throw Throwables.propagate(e);
 }
}
co.cask.cdap.data.securityHBaseTokenUtils

Javadoc

Helper class for getting HBase security delegation token.

Most used methods

  • castToken
  • obtainToken
    Gets a HBase delegation token and stores it in the given Credentials.

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • setContentView (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now