Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the HpcSchedulerAdapterInternalClient class
        /// </summary>
        /// <param name="headNodeMachine">indicating the headnode</param>
        public HpcSchedulerAdapterInternalClient(string headNodeMachine, string certThumbprint)
            : base(
                BindingHelper.HardCodedInternalSchedulerDelegationBinding,
                SoaHelper.CreateInternalCertEndpointAddress(new Uri(SoaHelper.GetSchedulerDelegationInternalAddress(headNodeMachine)), certThumbprint))
        {
#if BrokerLauncher
            BrokerTracing.TraceVerbose("[HpcSchedulerAdapterInternalClient] In constructor");
#endif
            // use certificate for cluster internal authentication
            this.ClientCredentials.UseInternalAuthentication(certThumbprint);

            if (BrokerIdentity.IsHAMode)
            {
                // Bug 10301 : Explicitly open channel when impersonating the resource group's account if running on failover cluster so identity flows correctly when
                //      calling HpcSession.
                //  NOTE: The patch we got from the WCF team (KB981001) only works when the caller is on a threadpool thread.
                //  NOTE: Channel must be opened before setting OperationTimeout
                using (BrokerIdentity identity = new BrokerIdentity())
                {
                    identity.Impersonate();
                    this.Open();
                }
            }

            this.InnerChannel.OperationTimeout = OperationTimeout;
        }
        /// <summary>
        /// Initializes a new instance of the HpcSchedulerAdapterInternalClient class
        /// </summary>
        /// <param name="headNode">indicating the headnode</param>
        public HpcSchedulerAdapterInternalClient(string headNode)
            : base(
                BindingHelper.HardCodedInternalSchedulerDelegationBinding,
                SoaHelper.CreateInternalCertEndpointAddress(
                    new Uri(SoaHelper.GetSchedulerDelegationInternalAddress(headNode)),
                    HpcContext.GetOrAdd(headNode, CancellationToken.None).GetSSLThumbprint().GetAwaiter().GetResult()))
        {
            // use certificate for cluster internal authentication
            string thunbprint = HpcContext.GetOrAdd(headNode, CancellationToken.None).GetSSLThumbprint().GetAwaiter().GetResult();

            this.ClientCredentials.UseInternalAuthentication(thunbprint);
            this.InnerChannel.OperationTimeout = OperationTimeout;
        }