public async Task <ApplicationSessionContext> GetServiceTicket(RequestServiceTicket rst, CancellationToken cancellation) { rst.S4uTarget = null; rst.S4uTicket = this.krbApReq.EncryptedTicket; rst.KdcOptions |= KdcOptions.CNameInAdditionalTicket; bool retried = false; while (true) { try { return(await client.GetServiceTicket(rst, cancellation)); } catch (InvalidOperationException) { if (retried) { break; } await client.Authenticate(this.credential); retried = true; } } return(null); }
/// <summary> /// Request a service ticket from a KDC using TGS-REQ /// </summary> /// <param name="rst">The parameters of the request</param> /// <param name="cancellation">A cancellation token to exit the request early</param> /// <returns>Returns a <see cref="ApplicationSessionContext"/> containing the service ticket</returns> public async Task <ApplicationSessionContext> GetDelegatedServiceTicket( RequestServiceTicket rst, CancellationToken cancellation = default ) { if (this.s4uProviderFactory == null) { throw new InvalidOperationException("S4U is not configured for this identity"); } var provider = this.s4uProviderFactory.CreateProvider(this.krbApReq); return(await provider.GetServiceTicket(rst, cancellation)); }