简体   繁体   English

在Xamarin中使用Azure AD的跨应用程序SSO

[英]Cross-app SSO using Azure AD in Xamarin

I am trying to enable cross app SSO into our Xamarin apps so that if a user has installed and signed in to one of the apps, he is automatically logged in to other apps of my organization. 我正在尝试将跨应用程序SSO启用到我们的Xamarin应用程序中,以便如果用户已安装并登录其中一个应用程序,他将自动登录到我的组织的其他应用程序。 The following document claims to achieve the requirement 以下文件声称可以达到要求

https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-sso-android . https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-sso-android We are following the non broker assisted login flow. 我们正在关注非经纪人协助的登录流程。

I have carefully fulfilled the three conditions stated below- 我已仔细履行下述三项条件─

  1. The apps are using the same android:sharedUserId in the manifest file. 这些应用程序在清单文件中使用相同的android:sharedUserId
  2. The native client used for them is the same. 用于它们的本机客户端是相同的。 Only the redirect url is different for the apps. 对于应用,只有重定向网址不同。
  3. All of them are signed using the same keystore. 所有这些都使用相同的密钥库进行签名。

But still the functionality is not yet achieved. 但仍然没有实现功能。 When i installed and logged in to one app, the second app is still prompting for credentials when i try to acquire the access token using the below line 当我安装并登录到一个应用程序时,当我尝试使用以下行获取访问令牌时,第二个应用程序仍在提示输入凭据

authResult = await authContext.AcquireTokenAsync(resource, clientId, new Uri(returnUri), new PlatformParameters((Activity)Forms.Context));

Kindly help me know if there is something that i can do to achieve that. 请帮助我知道我能做些什么来实现这一目标。

Due to restrictions in Xamarin.Forms, SSO without a broker (Microsoft Authenticator or Company portal) does not work with current version of ADAL. 由于Xamarin.Forms中的限制,没有代理(Microsoft身份验证器或公司门户)的SSO不适用于当前版本的ADAL。 We have a work item to update the documentation. 我们有一个工作项来更新文档。

This is a Xamarin.Forms issue. 这是一个Xamarin.Forms问题。 In order for SSO to work across apps without broker, you need to enable the "Ignore Security" flag, which is not recommended. 为了使SSO能够在没有代理的应用程序之间工作,您需要启用“忽略安全性”标志,这是不推荐的。 This requires the app name to be hardcoded and "ignore security". 这需要对应用程序名称进行硬编码并“忽略安全性”。

For example: Application.Context.CreatePackageContext(“com.companyname.ReproApp1”, PackageContextFlags.IgnoreSecurity).GetSharedPreferences(..)… 例如: Application.Context.CreatePackageContext(“com.companyname.ReproApp1”, PackageContextFlags.IgnoreSecurity).GetSharedPreferences(..)…

For the time being, it's recommended to use broker for SSO . 目前,建议使用经纪人进行SSO You can use Authenticator for both iOS and Android. 您可以在iOS和Android上使用Authenticator。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM