@VisibleForTesting org.apache.hadoop.security.token.Token<TimelineDelegationTokenIdentifier> getTimelineDelegationToken() throws IOException, YarnException { try { return timelineClient.getDelegationToken(timelineDTRenewer); } catch (Exception e ) { if (timelineServiceBestEffort) { LOG.warn("Failed to get delegation token from the timeline server: " + e.getMessage()); return null; } throw e; } }
@VisibleForTesting org.apache.hadoop.security.token.Token<TimelineDelegationTokenIdentifier> getTimelineDelegationToken() throws IOException, YarnException { try { return timelineClient.getDelegationToken(timelineDTRenewer); } catch (Exception e ) { if (timelineServiceBestEffort) { LOG.warn("Failed to get delegation token from the timeline server: " + e.getMessage()); return null; } throw e; } }
public static Token<TimelineDelegationTokenIdentifier> maybeAddTimelineToken( Configuration conf, Credentials credentials) throws IOException, YarnException { if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) { LOG.debug("Timeline service enabled -fetching token"); try(TimelineClient timelineClient = TimelineClient.createTimelineClient()) { timelineClient.init(conf); timelineClient.start(); Token<TimelineDelegationTokenIdentifier> token = timelineClient.getDelegationToken( CredentialUtils.getRMPrincipal(conf)); credentials.addToken(token.getService(), token); return token; } } else { LOG.debug("Timeline service is disabled"); return null; } }
return timelineClient.getDelegationToken(timelineDTRenewer); } catch (Exception e) { if (timelineServiceBestEffort) {
public static Token<TimelineDelegationTokenIdentifier> maybeAddTimelineToken( Configuration conf, Credentials credentials) throws IOException, YarnException { if (conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) { LOG.debug("Timeline service enabled -fetching token"); try(TimelineClient timelineClient = TimelineClient.createTimelineClient()) { timelineClient.init(conf); timelineClient.start(); Token<TimelineDelegationTokenIdentifier> token = timelineClient.getDelegationToken( CredentialUtils.getRMPrincipal(conf)); credentials.addToken(token.getService(), token); return token; } } else { LOG.debug("Timeline service is disabled"); return null; } }
return timelineClient.getDelegationToken(timelineDTRenewer); } catch (Exception e) { if (timelineServiceBestEffort) {
&& conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) { Token<TimelineDelegationTokenIdentifier> token = client.getDelegationToken( UserGroupInformation.getCurrentUser().getUserName()); UserGroupInformation.getCurrentUser().addToken(token);
&& conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) { Token<TimelineDelegationTokenIdentifier> token = client.getDelegationToken( UserGroupInformation.getCurrentUser().getUserName()); UserGroupInformation.getCurrentUser().addToken(token);
&& conf.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)) { Token<TimelineDelegationTokenIdentifier> token = client.getDelegationToken( UserGroupInformation.getCurrentUser().getUserName()); UserGroupInformation.getCurrentUser().addToken(token);
httpUserClient.getDelegationToken(httpUser.getShortUserName()); Assert.assertNotNull(token); TimelineDelegationTokenIdentifier tDT = token.decodeIdentifier(); token = fooUserClient.getDelegationToken(httpUser.getShortUserName()); Assert.assertNotNull(token); tDT = token.decodeIdentifier(); barUserClient.getDelegationToken(httpUser.getShortUserName()); Assert.fail(); } catch (Exception e) {