@Override public void addDelegationTokens(FileSystem fs, Credentials cred, String uname) throws IOException { // Use method addDelegationTokens instead of getDelegationToken to get all the tokens including KMS. fs.addDelegationTokens(uname, cred); }
public Token<?>[] addDelegationTokens(String renewer, Credentials credentials) throws java.io.IOException { return this.underlyingFs.addDelegationTokens(renewer, credentials); }
private static void collectTokens(FileSystem fs, TokenWrapper twrapper, Credentials creds, String userName) throws IOException { Token[] tokens = fs.addDelegationTokens(userName, creds); if(tokens != null && tokens.length > 0) { twrapper.tokens = ArrayUtils.addAll(twrapper.tokens, tokens); } } /**
@Override //AbstractFileSystem public List<Token<?>> getDelegationTokens(String renewer) throws IOException { return Arrays.asList(fsImpl.addDelegationTokens(renewer, null)); } }
@Override public Object run() { try { FileSystem fileSystem = FileSystem.get(nameNodeURI, configuration); Credentials credential= proxyUser.getCredentials(); if (configuration.get(STORM_USER_NAME_KEY) == null) { configuration.set(STORM_USER_NAME_KEY, hdfsPrincipal); } fileSystem.addDelegationTokens(configuration.get(STORM_USER_NAME_KEY), credential); LOG.info("Delegation tokens acquired for user {}", topologySubmitterUser); return credential; } catch (IOException e) { throw new RuntimeException(e); } } });
private void setupSecurityTokens(ContainerLaunchContext containerLaunchContext) throws IOException { Credentials credentials = UserGroupInformation.getCurrentUser().getCredentials(); String tokenRenewer = this.yarnConfiguration.get(YarnConfiguration.RM_PRINCIPAL); if (tokenRenewer == null || tokenRenewer.length() == 0) { throw new IOException("Failed to get master Kerberos principal for the RM to use as renewer"); } // For now, only getting tokens for the default file-system. Token<?> tokens[] = this.fs.addDelegationTokens(tokenRenewer, credentials); if (tokens != null) { for (Token<?> token : tokens) { LOGGER.info("Got delegation token for " + this.fs.getUri() + "; " + token); } } Closer closer = Closer.create(); try { DataOutputBuffer dataOutputBuffer = closer.register(new DataOutputBuffer()); credentials.writeTokenStorageToStream(dataOutputBuffer); ByteBuffer fsTokens = ByteBuffer.wrap(dataOutputBuffer.getData(), 0, dataOutputBuffer.getLength()); containerLaunchContext.setTokens(fsTokens); } catch (Throwable t) { throw closer.rethrow(t); } finally { closer.close(); } }
} catch (IOException ie) { try { Token<?>[] tokens = fs.addDelegationTokens(null, null); if (tokens.length == 0) { throw new IOException("addDelegationTokens returned no tokens");
fs.addDelegationTokens(tokenRenewer, credentials); if (tokens != null) { for (Token<?> token : tokens) {
final Token<?> tokens[] = fs.addDelegationTokens(tokRenewer, creds);
@Test public void testObtainTokens() throws Exception { Credentials credentials = new Credentials(); FileSystem fs = mock(FileSystem.class); TokenCache.obtainTokensForNamenodesInternal(fs, credentials, conf, renewer); verify(fs).addDelegationTokens(eq(renewer), eq(credentials)); }
fs.addDelegationTokens(tokenRenewer, credentials); if (tokens != null) { for (Token<?> token : tokens) {
@Override public Token<?>[] addDelegationTokens(String renewer, Credentials credentials) throws IOException { return fileSystem.addDelegationTokens(renewer, credentials); }
@Override public void addDelegationTokens(FileSystem fs, Credentials cred, String uname) throws IOException { // Use method addDelegationTokens instead of getDelegationToken to get all the tokens including KMS. fs.addDelegationTokens(uname, cred); }
public void addDelegationTokens(FileSystem fs, Credentials cred, String uname) throws IOException { // Use method addDelegationTokens instead of getDelegationToken to get all the tokens including KMS. fs.addDelegationTokens(uname, cred); } }
public void addDelegationTokens(FileSystem fs, Credentials cred, String uname) throws IOException { // Use method addDelegationTokens instead of getDelegationToken to get all the tokens including KMS. fs.addDelegationTokens(uname, cred); } }
private static void collectTokens(FileSystem fs, TokenWrapper twrapper, Credentials creds, String userName) throws IOException { Token[] tokens = fs.addDelegationTokens(userName, creds); if(tokens != null && tokens.length > 0) { twrapper.tokens = ArrayUtils.addAll(twrapper.tokens, tokens); } } /**
@Override //AbstractFileSystem public List<Token<?>> getDelegationTokens(String renewer) throws IOException { return Arrays.asList(fsImpl.addDelegationTokens(renewer, null)); } }
@Override //AbstractFileSystem public List<Token<?>> getDelegationTokens(String renewer) throws IOException { return Arrays.asList(fsImpl.addDelegationTokens(renewer, null)); } }
@Override //AbstractFileSystem public List<Token<?>> getDelegationTokens(String renewer) throws IOException { return Arrays.asList(fsImpl.addDelegationTokens(renewer, null)); } }
@Override @LimitedPrivate({"HDFS", "MapReduce"}) public Token<?>[] addDelegationTokens(String renewer, Credentials credentials) throws IOException { try { return underlyingFs.addDelegationTokens(renewer, credentials); } catch(FSError e) { throw propagateFSError(e); } }