internal virtual Org.Apache.Hadoop.Security.Token.Token <object> GetDelegationTokenFromHS (MRClientProtocol hsProxy) { GetDelegationTokenRequest request = recordFactory.NewRecordInstance <GetDelegationTokenRequest >(); request.SetRenewer(Master.GetMasterPrincipal(conf)); Org.Apache.Hadoop.Yarn.Api.Records.Token mrDelegationToken; mrDelegationToken = hsProxy.GetDelegationToken(request).GetDelegationToken(); return(ConverterUtils.ConvertFromYarn(mrDelegationToken, hsProxy.GetConnectAddress ())); }
internal virtual void AddHistoryToken(Credentials ts) { /* check if we have a hsproxy, if not, no need */ MRClientProtocol hsProxy = clientCache.GetInitializedHSProxy(); if (UserGroupInformation.IsSecurityEnabled() && (hsProxy != null)) { /* * note that get delegation token was called. Again this is hack for oozie * to make sure we add history server delegation tokens to the credentials */ RMDelegationTokenSelector tokenSelector = new RMDelegationTokenSelector(); Text service = resMgrDelegate.GetRMDelegationTokenService(); if (tokenSelector.SelectToken(service, ts.GetAllTokens()) != null) { Text hsService = SecurityUtil.BuildTokenService(hsProxy.GetConnectAddress()); if (ts.GetToken(hsService) == null) { ts.AddToken(hsService, GetDelegationTokenFromHS(hsProxy)); } } } }