【发布时间】:2019-08-03 05:42:10
【问题描述】:
我正在编写一个使用 ADAL 进行身份验证的 Xamarin.Forms 应用程序。我目前正在关注这里的流程。
https://forums.xamarin.com/discussion/comment/367489#Comment_367489
我正在使用 ADFS 进行身份验证,现在只担心 Android 客户端。我的问题是,每当我调用 AcquireTokenAsync 时,我都会看到登录屏幕,但没有内容。
我已经证明使用邮递员从 ADFS 获取令牌并且没有问题。
我的代码(我现在只是想证明这一点,我并不真正关心实现):
string authority = "https://myserver/adfs";
string resourceURI = "myidentity";
string clientID = "123-123-123";
string clientReturnURI = "http://localhost/";
var authContext = new AuthenticationContext(authority,false);
Task.Run(async () =>
{
var authResultAsync = await authContext.AcquireTokenAsync(resourceURI, clientID, new Uri(clientReturnURI), PlatformParameters);
});
我的平台参数正在页面渲染器中设置
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
this.page = e.NewElement as MainPage;
this.page.PlatformParameters = new PlatformParameters(this.Context as Activity);
}
我唯一的线索是我在控制台输出中得到了这个
Failed to validate the certificate chain, error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
我也明白了,但这似乎是一个红鲱鱼(一些博客文章说只是出现在我正在使用的 sdk 级别的 Android N 设备上)
Rejecting re-init on previously-failed class java.lang.Class<uO>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/TracingController;
对此的任何帮助将不胜感激,这几天我真的一直在努力。
【问题讨论】:
-
Connor Williams 能否使用 ADAL 包对 ADFS 进行身份验证?
标签: android xamarin xamarin.forms adfs adal