Java Code Examples for org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager

The following examples show how to use org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void init(FilterConfig filterConfig) throws ServletException {
  super.init(filterConfig);
  AuthenticationHandler handler = getAuthenticationHandler();
  AbstractDelegationTokenSecretManager dtSecretManager =
      (AbstractDelegationTokenSecretManager) filterConfig.getServletContext().
          getAttribute(DELEGATION_TOKEN_SECRET_MANAGER_ATTR);
  if (dtSecretManager != null && handler
      instanceof DelegationTokenAuthenticationHandler) {
    DelegationTokenAuthenticationHandler dtHandler =
        (DelegationTokenAuthenticationHandler) getAuthenticationHandler();
    dtHandler.setExternalDelegationTokenSecretManager(dtSecretManager);
  }
  if (handler instanceof PseudoAuthenticationHandler ||
      handler instanceof PseudoDelegationTokenAuthenticationHandler) {
    setHandlerAuthMethod(SaslRpcServer.AuthMethod.SIMPLE);
  }
  if (handler instanceof KerberosAuthenticationHandler ||
      handler instanceof KerberosDelegationTokenAuthenticationHandler) {
    setHandlerAuthMethod(SaslRpcServer.AuthMethod.KERBEROS);
  }

  // proxyuser configuration
  Configuration conf = getProxyuserConfiguration(filterConfig);
  ProxyUsers.refreshSuperUserGroupsConfiguration(conf, PROXYUSER_PREFIX);
}
 
Example 2
Source Project: big-c   Source File: DelegationTokenAuthenticationFilter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void init(FilterConfig filterConfig) throws ServletException {
  super.init(filterConfig);
  AuthenticationHandler handler = getAuthenticationHandler();
  AbstractDelegationTokenSecretManager dtSecretManager =
      (AbstractDelegationTokenSecretManager) filterConfig.getServletContext().
          getAttribute(DELEGATION_TOKEN_SECRET_MANAGER_ATTR);
  if (dtSecretManager != null && handler
      instanceof DelegationTokenAuthenticationHandler) {
    DelegationTokenAuthenticationHandler dtHandler =
        (DelegationTokenAuthenticationHandler) getAuthenticationHandler();
    dtHandler.setExternalDelegationTokenSecretManager(dtSecretManager);
  }
  if (handler instanceof PseudoAuthenticationHandler ||
      handler instanceof PseudoDelegationTokenAuthenticationHandler) {
    setHandlerAuthMethod(SaslRpcServer.AuthMethod.SIMPLE);
  }
  if (handler instanceof KerberosAuthenticationHandler ||
      handler instanceof KerberosDelegationTokenAuthenticationHandler) {
    setHandlerAuthMethod(SaslRpcServer.AuthMethod.KERBEROS);
  }

  // proxyuser configuration
  Configuration conf = getProxyuserConfiguration(filterConfig);
  ProxyUsers.refreshSuperUserGroupsConfiguration(conf, PROXYUSER_PREFIX);
}
 
Example 3
Source Project: hadoop   Source File: RMDelegationTokenIdentifier.java    License: Apache License 2.0 5 votes vote down vote up
@Private
public static void setSecretManager(
    AbstractDelegationTokenSecretManager<RMDelegationTokenIdentifier> secretManager,
    InetSocketAddress serviceAddress) {
  localSecretManager = secretManager;
  localServiceAddress = serviceAddress;
}
 
Example 4
Source Project: big-c   Source File: RMDelegationTokenIdentifier.java    License: Apache License 2.0 5 votes vote down vote up
@Private
public static void setSecretManager(
    AbstractDelegationTokenSecretManager<RMDelegationTokenIdentifier> secretManager,
    InetSocketAddress serviceAddress) {
  localSecretManager = secretManager;
  localServiceAddress = serviceAddress;
}
 
Example 5
Source Project: hadoop   Source File: RMAuthenticationFilter.java    License: Apache License 2.0 4 votes vote down vote up
public static void setDelegationTokenSecretManager(
    AbstractDelegationTokenSecretManager<?> manager) {
  RMAuthenticationFilter.manager = manager;
}
 
Example 6
Source Project: hadoop   Source File: DelegationTokenManager.java    License: Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
@SuppressWarnings("rawtypes")
public AbstractDelegationTokenSecretManager getDelegationTokenSecretManager() {
  return secretManager;
}
 
Example 7
Source Project: big-c   Source File: RMAuthenticationFilter.java    License: Apache License 2.0 4 votes vote down vote up
public static void setDelegationTokenSecretManager(
    AbstractDelegationTokenSecretManager<?> manager) {
  RMAuthenticationFilter.manager = manager;
}
 
Example 8
Source Project: big-c   Source File: DelegationTokenManager.java    License: Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
@SuppressWarnings("rawtypes")
public AbstractDelegationTokenSecretManager getDelegationTokenSecretManager() {
  return secretManager;
}
 
Example 9
Source Project: hadoop   Source File: DelegationTokenManager.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Sets an external <code>DelegationTokenSecretManager</code> instance to
 * manage creation and verification of Delegation Tokens.
 * <p/>
 * This is useful for use cases where secrets must be shared across multiple
 * services.
 *
 * @param secretManager a <code>DelegationTokenSecretManager</code> instance
 */
public void setExternalDelegationTokenSecretManager(
    AbstractDelegationTokenSecretManager secretManager) {
  this.secretManager.stopThreads();
  this.secretManager = secretManager;
  managedSecretManager = false;
}
 
Example 10
Source Project: big-c   Source File: DelegationTokenManager.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Sets an external <code>DelegationTokenSecretManager</code> instance to
 * manage creation and verification of Delegation Tokens.
 * <p/>
 * This is useful for use cases where secrets must be shared across multiple
 * services.
 *
 * @param secretManager a <code>DelegationTokenSecretManager</code> instance
 */
public void setExternalDelegationTokenSecretManager(
    AbstractDelegationTokenSecretManager secretManager) {
  this.secretManager.stopThreads();
  this.secretManager = secretManager;
  managedSecretManager = false;
}
 
Example 11
/**
 * Sets an external <code>DelegationTokenSecretManager</code> instance to
 * manage creation and verification of Delegation Tokens.
 * <p/>
 * This is useful for use cases where secrets must be shared across multiple
 * services.
 *
 * @param secretManager a <code>DelegationTokenSecretManager</code> instance
 */
public void setExternalDelegationTokenSecretManager(
    AbstractDelegationTokenSecretManager secretManager) {
  tokenManager.setExternalDelegationTokenSecretManager(secretManager);
}
 
Example 12
/**
 * Sets an external <code>DelegationTokenSecretManager</code> instance to
 * manage creation and verification of Delegation Tokens.
 * <p/>
 * This is useful for use cases where secrets must be shared across multiple
 * services.
 *
 * @param secretManager a <code>DelegationTokenSecretManager</code> instance
 */
public void setExternalDelegationTokenSecretManager(
    AbstractDelegationTokenSecretManager secretManager) {
  tokenManager.setExternalDelegationTokenSecretManager(secretManager);
}