简体   繁体   English

Xamarin Forms UWP ZAEA23489CE3AA9B64061028E0CDA430Z 应用程序中的 SSO

[英]SSO in Xamarin Forms UWP app on Windows 10

We are working on a Xamarin Forms UWP app which has a requirement, when we click on the app icon, automatically log into the app without having to enter any user details.我们正在开发一个 Xamarin Forms UWP 应用程序,它有一个要求,当我们点击应用程序图标时,自动登录到应用程序而无需输入任何用户详细信息。 The app should use the same credentials used to login to the Windows 10 device.该应用程序应使用用于登录 Windows 10 设备的相同凭据。 Basically, sign in user without prompting them to login again, fetch access token and get data from API.基本上,在不提示他们再次登录的情况下登录用户,获取访问令牌并从 API 获取数据。

The user would use their enterprise credentials to login and are on the enterprise network用户将使用他们的企业凭据登录并在企业网络上

Can someone point me to the right direction on how can we achieve this?有人可以指出我们如何实现这一目标的正确方向吗?

Thanks in advance.提前致谢。

SSO in Xamarin Forms UWP app on Windows 10 Xamarin Forms UWP ZAEA23489CE3AA9B64061028E0CDA430Z 应用程序中的 SSO

You could use Xamarin.Essentials: Web Authenticator to auth the specific and get token the store the data in to Application.Current.Properties like the following您可以使用Xamarin.Essentials: Web Authenticator来验证特定并获取令牌,将数据存储到Application.Current.Properties中,如下所示

Application.Current.Properties ["token"] = token;

When you open the app, you need check if Application.Current.Properties ["token"] contain the value, if the value is not null, you could login the app directly, if not, please get token and store it.打开应用时,需要检查Application.Current.Properties ["token"]是否包含该值,如果该值不是null,您可以直接登录应用,如果没有,请获取token并保存。

And if the token contains expiration time, you still need to check the if token is out of data and re-auth.并且如果token包含过期时间,还需要检查token是否数据不足并重新认证。

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

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