/// <exception cref="System.IO.IOException"/>
            /// <exception cref="System.Exception"/>
            public override long Renew <_T0>(Org.Apache.Hadoop.Security.Token.Token <_T0> token
                                             , Configuration conf)
            {
                ApplicationClientProtocol rmClient = GetRmClient(token, conf);

                if (rmClient != null)
                {
                    try
                    {
                        RenewDelegationTokenRequest request = Records.NewRecord <RenewDelegationTokenRequest
                                                                                 >();
                        request.SetDelegationToken(ConvertToProtoToken(token));
                        return(rmClient.RenewDelegationToken(request).GetNextExpirationTime());
                    }
                    catch (YarnException e)
                    {
                        throw new IOException(e);
                    }
                    finally
                    {
                        RPC.StopProxy(rmClient);
                    }
                }
                else
                {
                    return(localSecretManager.RenewToken((Org.Apache.Hadoop.Security.Token.Token <RMDelegationTokenIdentifier
                                                                                                  >)token, GetRenewer(token)));
                }
            }
Example #2
0
            /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
            /// <exception cref="System.IO.IOException"/>
            public long Run()
            {
                RenewDelegationTokenRequest request = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                      <RenewDelegationTokenRequest>();

                request.SetDelegationToken(dToken);
                return(clientRMService.RenewDelegationToken(request).GetNextExpirationTime());
            }
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 public override RenewDelegationTokenResponse RenewDelegationToken(RenewDelegationTokenRequest
                                                                   request)
 {
     this._enclosing.ResetStartFailoverFlag(true);
     // make sure failover has been triggered
     NUnit.Framework.Assert.IsTrue(this._enclosing.WaittingForFailOver());
     return(RenewDelegationTokenResponse.NewInstance(this._enclosing.CreateNextExpirationTime
                                                         ()));
 }
Example #4
0
        /// <exception cref="System.Exception"/>
        public virtual void TestRenewDelegationTokenOnHA()
        {
            RenewDelegationTokenRequest request = RenewDelegationTokenRequest.NewInstance(cluster
                                                                                          .CreateFakeToken());
            long newExpirationTime = ClientRMProxy.CreateRMProxy <ApplicationClientProtocol>(this
                                                                                             .conf).RenewDelegationToken(request).GetNextExpirationTime();

            NUnit.Framework.Assert.AreEqual(newExpirationTime, cluster.CreateNextExpirationTime
                                                ());
        }
Example #5
0
 /// <exception cref="System.IO.IOException"/>
 public virtual RenewDelegationTokenResponse RenewDelegationToken(RenewDelegationTokenRequest
                                                                  request)
 {
     SecurityProtos.RenewDelegationTokenRequestProto requestProto = ((RenewDelegationTokenRequestPBImpl
                                                                      )request).GetProto();
     try
     {
         return(new RenewDelegationTokenResponsePBImpl(proxy.RenewDelegationToken(null, requestProto
                                                                                  )));
     }
     catch (ServiceException e)
     {
         throw UnwrapAndThrowException(e);
     }
 }
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        public override long Renew <_T0>(Org.Apache.Hadoop.Security.Token.Token <_T0> token
                                         , Configuration conf)
        {
            Org.Apache.Hadoop.Yarn.Api.Records.Token dToken = Org.Apache.Hadoop.Yarn.Api.Records.Token
                                                              .NewInstance(token.GetIdentifier(), token.GetKind().ToString(), token.GetPassword
                                                                               (), token.GetService().ToString());
            MRClientProtocol histProxy = InstantiateHistoryProxy(conf, SecurityUtil.GetTokenServiceAddr
                                                                     (token));

            try
            {
                RenewDelegationTokenRequest request = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                      <RenewDelegationTokenRequest>();
                request.SetDelegationToken(dToken);
                return(histProxy.RenewDelegationToken(request).GetNextExpirationTime());
            }
            finally
            {
                StopHistoryProxy(histProxy);
            }
        }
Example #7
0
            /// <exception cref="System.IO.IOException"/>
            public virtual RenewDelegationTokenResponse RenewDelegationToken(RenewDelegationTokenRequest
                                                                             request)
            {
                if (!this.IsAllowedDelegationTokenOp())
                {
                    throw new IOException("Delegation Token can be renewed only with kerberos authentication"
                                          );
                }
                Org.Apache.Hadoop.Yarn.Api.Records.Token protoToken = request.GetDelegationToken(
                    );
                Org.Apache.Hadoop.Security.Token.Token <MRDelegationTokenIdentifier> token = new Org.Apache.Hadoop.Security.Token.Token
                                                                                             <MRDelegationTokenIdentifier>(((byte[])protoToken.GetIdentifier().Array()), ((byte
                                                                                                                                                                           [])protoToken.GetPassword().Array()), new Text(protoToken.GetKind()), new Text(protoToken
                                                                                                                                                                                                                                                          .GetService()));
                string user        = UserGroupInformation.GetCurrentUser().GetShortUserName();
                long   nextExpTime = this._enclosing.jhsDTSecretManager.RenewToken(token, user);
                RenewDelegationTokenResponse renewResponse = Org.Apache.Hadoop.Yarn.Util.Records.
                                                             NewRecord <RenewDelegationTokenResponse>();

                renewResponse.SetNextExpirationTime(nextExpTime);
                return(renewResponse);
            }
Example #8
0
 /// <exception cref="System.IO.IOException"/>
 public virtual RenewDelegationTokenResponse RenewDelegationToken(RenewDelegationTokenRequest
                                                                  request)
 {
     throw new IOException("MR AM not authorized to renew delegation" + " token");
 }
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 /// <exception cref="System.IO.IOException"/>
 public virtual RenewDelegationTokenResponse RenewDelegationToken(RenewDelegationTokenRequest
                                                                  request)
 {
     return(null);
 }
Example #10
0
 /// <exception cref="System.IO.IOException"/>
 public virtual RenewDelegationTokenResponse RenewDelegationToken(RenewDelegationTokenRequest
                                                                  request)
 {
     /* Should not be invoked by anyone. */
     throw new NotImplementedException();
 }