当前位置: 首页>>代码示例>>C#>>正文


C# IAuthenticationRequest.GetRedirectingResponseAsync方法代码示例

本文整理汇总了C#中IAuthenticationRequest.GetRedirectingResponseAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IAuthenticationRequest.GetRedirectingResponseAsync方法的具体用法?C# IAuthenticationRequest.GetRedirectingResponseAsync怎么用?C# IAuthenticationRequest.GetRedirectingResponseAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAuthenticationRequest的用法示例。


在下文中一共展示了IAuthenticationRequest.GetRedirectingResponseAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetWindowPopupScriptAsync

		/// <summary>
		/// Gets the <c>window.open</c> javascript snippet to use to open a popup window
		/// compliant with the UI extension.
		/// </summary>
		/// <param name="relyingParty">The relying party.</param>
		/// <param name="request">The authentication request to place in the window.</param>
		/// <param name="windowName">The name to assign to the popup window.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <returns>
		/// A string starting with 'window.open' and forming just that one method call.
		/// </returns>
		internal static async Task<string> GetWindowPopupScriptAsync(OpenIdRelyingParty relyingParty, IAuthenticationRequest request, string windowName, CancellationToken cancellationToken) {
			Requires.NotNull(relyingParty, "relyingParty");
			Requires.NotNull(request, "request");
			Requires.NotNullOrEmpty(windowName, "windowName");

			var response = await request.GetRedirectingResponseAsync(cancellationToken);
			Uri popupUrl = response.GetDirectUriRequest();

			return string.Format(
				CultureInfo.InvariantCulture,
				"(window.showModalDialog ? window.showModalDialog({0}, {1}, 'status:0;resizable:1;scroll:1;center:1;dialogWidth:{2}px; dialogHeight:{3}') : window.open({0}, {1}, 'status=0,toolbar=0,location=1,resizable=1,scrollbars=1,left=' + ((screen.width - {2}) / 2) + ',top=' + ((screen.height - {3}) / 2) + ',width={2},height={3}'));",
				MessagingUtilities.GetSafeJavascriptValue(popupUrl.AbsoluteUri),
				MessagingUtilities.GetSafeJavascriptValue(windowName),
				OpenId.Extensions.UI.UIUtilities.PopupWidth,
				OpenId.Extensions.UI.UIUtilities.PopupHeight);
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:27,代码来源:UIUtilities.cs

示例2: GetRedirectUrlAsync

		/// <summary>
		/// Gets the full URL that carries an OpenID message, even if it exceeds the normal maximum size of a URL,
		/// for purposes of sending to an AJAX component running in the browser.
		/// </summary>
		/// <param name="request">The authentication request.</param>
		/// <param name="immediate"><c>true</c>to create a checkid_immediate request;
		/// <c>false</c> to create a checkid_setup request.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <returns>
		/// The absolute URL that carries the entire OpenID message.
		/// </returns>
		private async Task<Uri> GetRedirectUrlAsync(IAuthenticationRequest request, bool immediate, CancellationToken cancellationToken) {
			Requires.NotNull(request, "request");

			request.Mode = immediate ? AuthenticationRequestMode.Immediate : AuthenticationRequestMode.Setup;
			var response = await request.GetRedirectingResponseAsync(cancellationToken);
			return response.GetDirectUriRequest();
		}
开发者ID:Adilson,项目名称:dotnetopenid,代码行数:18,代码来源:OpenIdAjaxRelyingParty.cs


注:本文中的IAuthenticationRequest.GetRedirectingResponseAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。