本文整理汇总了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);
}
示例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();
}