org.apache.hadoop.security.authentication.client.Authenticator Java Examples
The following examples show how to use
org.apache.hadoop.security.authentication.client.Authenticator.
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
Source File: PseudoWebHDFSConnection.java From Transwarp-Sample-Code with MIT License | 6 votes |
public static synchronized Token generateToken(String srvUrl, String princ, String passwd) { AuthenticatedURL.Token newToken = new AuthenticatedURL.Token(); Authenticator authenticator = new PseudoAuthenticator(princ); try { String spec = MessageFormat.format( "/webhdfs/v1/?op=GETHOMEDIRECTORY&user.name={0}", princ); HttpURLConnection conn = new AuthenticatedURL(authenticator) .openConnection(new URL(new URL(srvUrl), spec), newToken); conn.connect(); conn.disconnect(); } catch (Exception ex) { logger.error(ex.getMessage()); logger.error("[" + princ + ":" + passwd + "]@" + srvUrl, ex); } return newToken; }
Example #2
Source File: KerberosUgiAuthenticator.java From hadoop with Apache License 2.0 | 5 votes |
@Override protected Authenticator getFallBackAuthenticator() { return new PseudoAuthenticator() { @Override protected String getUserName() { try { return UserGroupInformation.getLoginUser().getUserName(); } catch (IOException e) { throw new SecurityException("Failed to obtain current username", e); } } }; }
Example #3
Source File: KerberosDelegationTokenAuthenticator.java From hadoop with Apache License 2.0 | 5 votes |
public KerberosDelegationTokenAuthenticator() { super(new KerberosAuthenticator() { @Override protected Authenticator getFallBackAuthenticator() { return new PseudoDelegationTokenAuthenticator(); } }); }
Example #4
Source File: KerberosUgiAuthenticator.java From big-c with Apache License 2.0 | 5 votes |
@Override protected Authenticator getFallBackAuthenticator() { return new PseudoAuthenticator() { @Override protected String getUserName() { try { return UserGroupInformation.getLoginUser().getUserName(); } catch (IOException e) { throw new SecurityException("Failed to obtain current username", e); } } }; }
Example #5
Source File: KerberosDelegationTokenAuthenticator.java From big-c with Apache License 2.0 | 5 votes |
public KerberosDelegationTokenAuthenticator() { super(new KerberosAuthenticator() { @Override protected Authenticator getFallBackAuthenticator() { return new PseudoDelegationTokenAuthenticator(); } }); }
Example #6
Source File: TimelineReaderFactory.java From tez with Apache License 2.0 | 5 votes |
private static Authenticator getTokenAuthenticator() throws TezException { String authenticatorClazzName; if (UserGroupInformation.isSecurityEnabled()) { authenticatorClazzName = KERBEROS_DELEGATION_TOKEN_AUTHENTICATOR_CLAZZ_NAME; } else { authenticatorClazzName = PSEUDO_DELEGATION_TOKEN_AUTHENTICATOR_CLAZZ_NAME; } return ReflectionUtils.createClazzInstance(authenticatorClazzName); }
Example #7
Source File: TimelineReaderFactory.java From tez with Apache License 2.0 | 5 votes |
public TokenAuthenticatedURLConnectionFactory(ConnectionConfigurator connConfigurator, Authenticator authenticator, UserGroupInformation authUgi, String doAsUser) throws TezException { this.connConfigurator = connConfigurator; this.authenticator = authenticator; this.authUgi = authUgi; this.doAsUser = doAsUser; this.token = ReflectionUtils.createClazzInstance( DELEGATION_TOKEN_AUTHENTICATED_URL_TOKEN_CLASS_NAME, null, null); }
Example #8
Source File: DelegationTokenAuthenticator.java From hadoop with Apache License 2.0 | 4 votes |
public DelegationTokenAuthenticator(Authenticator authenticator) { this.authenticator = authenticator; }
Example #9
Source File: DelegationTokenAuthenticator.java From big-c with Apache License 2.0 | 4 votes |
public DelegationTokenAuthenticator(Authenticator authenticator) { this.authenticator = authenticator; }
Example #10
Source File: KerberosAuthenticator2.java From Transwarp-Sample-Code with MIT License | 2 votes |
/** * If the specified URL does not support SPNEGO authentication, a fallback * {@link Authenticator} will be used. * <p/> * This implementation returns a {@link PseudoAuthenticator}. * * @return the fallback {@link Authenticator}. */ protected Authenticator getFallBackAuthenticator() { return new PseudoAuthenticator(); }