예제 #1
0
        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));
                    }
                }
            }
        }