Beispiel #1
0
        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
                                                      ()));
        }
Beispiel #2
0
        /// <exception cref="System.Exception"/>
        public virtual void TestHistoryServerToken()
        {
            //Set the master principal in the config
            conf.Set(YarnConfiguration.RmPrincipal, "foo@LOCAL");
            string           masterPrincipal = Master.GetMasterPrincipal(conf);
            MRClientProtocol hsProxy         = Org.Mockito.Mockito.Mock <MRClientProtocol>();

            Org.Mockito.Mockito.When(hsProxy.GetDelegationToken(Matchers.Any <GetDelegationTokenRequest
                                                                              >())).ThenAnswer(new _Answer_410(masterPrincipal));
            // check that the renewer matches the cluster's RM principal
            // none of these fields matter for the sake of the test
            UserGroupInformation.CreateRemoteUser("someone").DoAs(new _PrivilegedExceptionAction_432
                                                                      (this, hsProxy));
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual SecurityProtos.GetDelegationTokenResponseProto GetDelegationToken(
            RpcController controller, SecurityProtos.GetDelegationTokenRequestProto proto)
        {
            GetDelegationTokenRequest request = new GetDelegationTokenRequestPBImpl(proto);

            try
            {
                GetDelegationTokenResponse response = real.GetDelegationToken(request);
                return(((GetDelegationTokenResponsePBImpl)response).GetProto());
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }