本文整理汇总了C#中Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.GetAuthorizationRequestUrlAsync方法的典型用法代码示例。如果您正苦于以下问题:C# AuthenticationContext.GetAuthorizationRequestUrlAsync方法的具体用法?C# AuthenticationContext.GetAuthorizationRequestUrlAsync怎么用?C# AuthenticationContext.GetAuthorizationRequestUrlAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext
的用法示例。
在下文中一共展示了AuthenticationContext.GetAuthorizationRequestUrlAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAuthorizationRequestURLTestAsync
internal static async Task GetAuthorizationRequestURLTestAsync(Sts sts)
{
var context = new AuthenticationContext(sts.Authority, sts.ValidateAuthority);
Uri uri = null;
try
{
uri = await context.GetAuthorizationRequestUrlAsync(null, sts.ValidClientId, sts.ValidDefaultRedirectUri, sts.ValidUserId, "extra=123");
}
catch (ArgumentNullException ex)
{
Verify.AreEqual(ex.ParamName, "resource");
}
uri = await context.GetAuthorizationRequestUrlAsync(sts.ValidResource, sts.ValidClientId, sts.ValidDefaultRedirectUri, sts.ValidUserId, "extra=123");
Verify.IsNotNull(uri);
Verify.IsTrue(uri.AbsoluteUri.Contains("login_hint"));
Verify.IsTrue(uri.AbsoluteUri.Contains("extra=123"));
uri = await context.GetAuthorizationRequestUrlAsync(sts.ValidResource, sts.ValidClientId, sts.ValidDefaultRedirectUri, UserIdentifier.AnyUser, null);
Verify.IsNotNull(uri);
Verify.IsFalse(uri.AbsoluteUri.Contains("login_hint"));
Verify.IsFalse(uri.AbsoluteUri.Contains("client-request-id="));
context.CorrelationId = Guid.NewGuid();
uri = await context.GetAuthorizationRequestUrlAsync(sts.ValidResource, sts.ValidClientId, sts.ValidDefaultRedirectUri, sts.ValidUserId, "extra");
Verify.IsNotNull(uri);
Verify.IsTrue(uri.AbsoluteUri.Contains("client-request-id="));
}