简体   繁体   English

UWP - 在 ADAL 身份验证中启用专用网络

[英]UWP - Enable Private Network in ADAL Authentication

We are creating a UWP app using Xamarin.forms and for Login purposes, ADAL has been used.我们正在使用 Xamarin.forms 创建一个UWP应用程序,出于登录目的,已使用ADAL Authentication has been happening successfully when we are connected to VPN.当我们连接到 VPN 时,身份验证已成功进行。 But when we try to run the same app in the Client.network where we don't require VPN, App is not showing ADAL IWA (Integrated Windows Authentication), instead, we are getting the Error message “We can't connect to the service you need right now.但是当我们尝试在不需要 VPN 的 Client.network 中运行相同的应用程序时,应用程序没有显示 ADAL IWA(集成 Windows 身份验证),相反,我们收到错误消息“我们无法连接到您现在需要的服务。 Check your.network connection or try this again later.”检查您的网络连接或稍后重试。” I have attached an image for reference.我附上了一张图片以供参考。 On investigating further, we found an article about the same issue with the solution in the Microsoft forum ( https://learn.microsoft.com/en-us/azure/active-directory/develop/msal.net-uwp-considerations ).进一步调查后,我们在 Microsoft 论坛 ( https://learn.microsoft.com/en-us/azure/active-directory/develop/msal.net-uwp-considerations ) 中发现了一篇关于该解决方案的相同问题的文章. The solution is to enable the Private Network in the Registry Editor in Authhost.exe in HKEY_LOCAL_MACHINE.解决方法是在HKEY_LOCAL_MACHINE 中的Authhost.exe 中的注册表编辑器中启用专用网络。 On running the below command, we could be able to bypass the issue.在运行下面的命令时,我们可以绕过这个问题。 But we don't want to play on editing the registry on each end-user machine or device.但我们不想在每个最终用户机器或设备上编辑注册表。 So, we tried editing the registry programmatically inside the app, but we got a security exception.因此,我们尝试在应用程序内以编程方式编辑注册表,但出现安全异常。

Enabling Private Network Through Command Prompt:通过命令提示符启用专用网络:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\authhost.exe\EnablePrivateNetwork = 00000001 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\authhost.exe\EnablePrivateNetwork = 00000001

Error while trying to edit Registry Programmatically:尝试以编程方式编辑注册表时出错:

System.Security.SecurityException: 'Requested registry access is not allowed.' System.Security.SecurityException:“不允许请求的注册表访问权限。”

Reference for Editing Registry Programmatically:以编程方式编辑注册表的参考:

https://codingvision.net/c-edit-registry-keys-or-values https://codingvision.net/c-edit-registry-keys-or-values

So, we need to understand, what is the best way to address this issue?所以,我们需要了解,解决这个问题的最佳方法是什么?

  1. I don't want to alter the Registry using the command prompt or Registry Editor App.我不想使用命令提示符或注册表编辑器应用程序更改注册表。

  2. Is it possible to enable private.network via AD group policy or Windows OS Settings.是否可以通过 AD 组策略或 Windows 操作系统设置启用 private.network。

  3. Any other possible way to Enable Private Network启用专用网络的任何其他可能方式

Note: The same code works fine with Android Environment.注意:相同的代码适用于Android环境。 The problem is only with Windows.问题仅在于 Windows。

服务不可用图像

• There is no group policy existent which changes this option in registry for the private.network in ADAL authentication. • ADAL 身份验证中不存在更改注册表中private.network 的此选项的组策略。 But you surely can change this registry setting through group policy as it is the only solution to enable private.network for ADAL authentication.但是您肯定可以通过组策略更改此注册表设置,因为它是为 ADAL 身份验证启用 private.network 的唯一解决方案。 To do this, please follow the steps below in group policy: -为此,请按照组策略中的以下步骤操作:-

a) Login to the Group policy server/domain controller and open the group policy management GUI, then select the default domain group policy and edit it. a) 登录到组策略服务器/域 controller并打开组策略管理 GUI,然后 select 默认域组策略并进行编辑。

b) Then go to 'Computer Configuration --> Preferences-> Windows settings --> Registry --> New --> Registry Wizard' . b) 然后go到'计算机配置-->首选项->Windows设置-->注册表-->新建-->注册表向导' The registry wizard opens and allows you to connect to the remote computer and select the appropriate registry key, ie, 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\authhost.exe\EnablePrivateNetwork = 00000001'注册表向导打开并允许您连接到远程计算机和 select 相应的注册表项,即“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\authhost.exe\EnablePrivateNetwork = 00000001”

c) Select the correct client system that has the above registry entry present in their system and then select it. c) Select 正确的客户端系统,其系统中存在上述注册表项,然后是 select。 Also, please note that the registry browser allows you to select the keys from the hives 'HKEY_LOCAL_MACHINE' and 'HKEY_USERS' only.另外,请注意,注册表浏览器仅允许您访问配置单元“HKEY_LOCAL_MACHINE”“HKEY_USERS”中的 select 键。 Also, if the remote system is unable to connect from the registry finder, please ensure that the system is turned on, access is not blocked by firewall and the remote registry service is not stopped.此外,如果远程系统无法从注册表查找器连接,请确保系统已打开,访问未被防火墙阻止,并且远程注册表服务未停止。

d) Once done, the above registry entry is imported into the Group policy console along with the desired path for that registry key in the workspace. d) 完成后,上述注册表项连同该注册表项在工作区中的所需路径一起导入到组策略控制台中。 Once done, the GPO should be deployed and, in this way, the registry key will be pushed and updated on all the client systems in that domain.network.完成后,应部署 GPO,这样,注册表项将在该域网络中的所有客户端系统上推送和更新。

• You will have to create a new Group policy object and select the appropriate OU from the Group policy server while deploying this registry key if you do not want to deploy it to all the domain.networks. • 如果您不想将其部署到所有域.networks,则在部署此注册表项时必须从组策略服务器创建新的组策略 object 和 select 相应的 OU。

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

相关问题 获取重定向 URI 以便使用 ADAL 实施代理身份验证 - Getting Redirect URI in order to implement broker authentication using ADAL SSH 进入 private.network 中的 VM 不工作 - SSH into VM in private network not working Twilio 带静默网络认证 - Twilio with Silent Network Authentication 通过 API 或 SDK 启用 Firebase 身份验证 - Enable Firebase Authentication via API or SDK 如何将流量从另一个 VPC 网络路由到 GKE 私有主节点 - Howto route traffic to GKE private master from another VPC network 如何使用 mysql workbench 连接到私有 rds in.network 负载均衡器和 ecs - How to connect to private rds in network load balancer and ecs with mysql workbench 来自私有 GKE 集群上公共 IP 的可疑 ICMP.network 流量 - Suspicious ICMP network traffic from public IPs on private GKE cluster adal4j api (ADAL) 用于 Java 的用法 - Usage of adal4j api (ADAL) for Java 自托管代理 private.network DevOps 连接问题 - Self-Hosted agent private network DevOps connectivity issue ARM 模板 - 从 a.network interface id 获取私有地址 ip - ARM Template - Get a private ip address from a network interface id
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM