Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在公司广告中使用Windows 10上的ADAL for.NET登录Azure广告_C#_Azure_Azure Active Directory_Adal - Fatal编程技术网

C# 在公司广告中使用Windows 10上的ADAL for.NET登录Azure广告

C# 在公司广告中使用Windows 10上的ADAL for.NET登录Azure广告,c#,azure,azure-active-directory,adal,C#,Azure,Azure Active Directory,Adal,最近,我遇到了以下行为,这是特定于此环境的:Windows10+a公司active directory ... authContext = new AuthenticationContext(authority); ... var tokenResult = await authContext.AcquireTokenAsync( resourceId, clientId, redirectUri, new PlatformParameters(Prompt

最近,我遇到了以下行为,这是特定于此环境的:Windows10+a公司active directory

...

authContext = new AuthenticationContext(authority);

...

var tokenResult = await authContext.AcquireTokenAsync(
    resourceId,
    clientId,
    redirectUri,
    new PlatformParameters(PromptBehavior.Auto, parentWindow));
使用
PromptBehavior.Auto
我无法使用正确的帐户登录,因为ADAL库没有显示登录窗口(在屏幕截图上),而是使用我当前登录到Windows 10的帐户(这最终显然会导致拒绝访问错误,因为我登录到Windows的帐户不在我连接到的Azure广告中)

有趣的是,对于在Windows 7\8上工作的同事来说,同样的代码也能正常工作


那么,这里可能存在什么问题?

PromptBehavior.Auto
将尝试使用活动令牌,但如果刷新令牌无效/过期或需要凭据,则将显示登录页面。您可能有一个会话由于某种原因需要重新验证,并且会收到提示再次登录或者缓存中的用户。如果您在Win 10设备上加入域,它将自动使用该用户


您应该能够点击
使用其他帐户
按钮登录其他用户。或者,您可以使用
PromptBehavior。始终
,这将忽略缓存并允许您登录新用户。

“如果您在Win 10设备上加入域,它将自动使用该用户。”它是否仅适用于Win 10?正如我前面所述,Win 7\8不尝试使用域用户,而只是显示登录弹出窗口(假设它是第一次登录并且正在使用“PromptBehavior.Auto”选项)。如何关闭默认使用的Win 10域帐户的此行为(可能是某些windows设置)对于“PromptBehavior.Auto”?显然,我可以使用“PromptBehavior.Always”或“PromptBehavior.RefreshSession”值来显示弹出窗口并使用所需帐户登录。我不知道有什么方法可以在不使用
PromptBehavior.Always
的情况下禁用此功能。Windows中可能有设置,但不确定。