![](/img/trans.png)
[英]ASP.NET MVC 5: App Pool, Windows Authentication and Active Directory
[英]Active Directory Authentication Library with Windows Universal App
ADAL应支持或计划支持哪个版本的UWP样式的应用程序?
当前的稳定版本(2.18.206251556)给我例外:
未处理System.ExecutionEngineException HResult = -2146233082
消息=类型为'System.ExecutionEngineException'的异常被抛出。 的InnerException:
当我尝试使用以下代码获取令牌时:
public async Task<string> GetOAuthTokenFromAAD()
{
var authenticationContext = new AuthenticationContext(String.Format("{0}/{1}", ADALServiceURL, TenantDomain));
var result = await authenticationContext.AcquireTokenAsync(string.Format("{0}/", ARMBillingServiceURL), ClientId, new Uri(ADALRedirectURL));
if (result == null)
{
throw new InvalidOperationException("Failed to obtain the JWT token");
}
return result.AccessToken;
}
最新版本3.4.206191646-alpha给我错误:
严重性代码说明项目文件行错误CS1503参数3:无法从“ System.Uri”转换为“ Microsoft.IdentityModel.Clients.ActiveDirectory.UserCredential” CloudScheduler
如果已正确理解,则不需要将UserCredential参数作为参数,而应使用URI类型。
好的,因此我设法使此功能适用于示例Todolist应用。 AcquireTokenAsync的重载现在需要传递一个新的PlatformParameters选项。添加完后,您就可以使用了。
var p = new PlatformParameters(PromptBehavior.Always, false);
AuthenticationResult result = await authContext.AcquireTokenAsync(todoListResourceId, clientId, redirectURI, p);
ADAL 2.18应该可以与通用应用程序一起使用。 您正在使用哪些Win10 / VS2015 / Win10工具版本? 另外,您是否可以按照https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/blob/master/README.md中的说明捕获日志并将其发布在此处? 大约3.x-仍然是alpha。 有关如何使用其API的信息,请参阅https://github.com/AzureADSamples/NativeClient-MultiTarget-DotNet-但是您无需使用3.x-2.18应该可以使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.