使用Azure AD保护WCF [英] WCF secured with Azure AD

查看:83
本文介绍了使用Azure AD保护WCF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由Azure托管并由Azure AD保护的WCF服务.当我使用Web访问服务时,系统会提示我使用Azure登录,成功登录后,我会到达数据.我正在尝试访问Winforms数据表单,我到达OAuth2登录屏幕,我成功登录并获取令牌.我将令牌添加到上下文标头中,但仍然收到此消息: InnerException = "You do not have permission to view this directory or page."

I have a WCF service hosted by Azure and secured by Azure AD. when I use the web to access the service I am prompted with the Azure login,after a successful login,I reach the data. I am trying to access the data form Winforms, I reach the OAuth2 login screen, I successfully login and get the token. I add the token to the context headers, but still receive this message: InnerException = "You do not have permission to view this directory or page."

有关如何从Winforms访问使用Azure AD保护的WCF的任何帮助?

any help on how to access WCF secured with Azure AD, from Winforms ?

推荐答案

此错误可能有多种原因,很难猜测. 但是这里有几件事要检查.

There could be multiple reasons for this error and it's hard to guess. But here are few things to check.

  • 您的客户端应用程序(Winform)已在Azure AD中注册并具有 访问您的Web应用的权限.确保桌面/移动应用具有 通过Azure AD注册为本地应用程序.

  • Your client application (Winform) is registered with Azure AD and has permission to access your web app. Make sure desktop/mobile apps have to be registered wtih Azure AD as native app.

您的受众群体已在Azure AD中正确设置.我见过很多人 如果他们没有正确设置它,就会感到困难.

Your Audience is set correctly in Azure AD . I have seen many people struggle if they don't have it set properly.

如果您的WCF托管在应用程序服务中,请打开实时日志记录.转到应用服务,然后打开诊断日志".在诊断日志"下,将应用日志"设置为详细.之后,转到应用程序服务中的日志流"以查看实时应用程序日志记录.现在,如果您与客户一起使用Web应用程序,则应该能够看到为什么要获得401未经授权的原因.

If your WCF is hosted in app services then turn on the real time logging. Go to app services and turn on the "Diagnostic logs".Under "Diagnostic logs" set the "application log" to verbose. After this go to "Log Stream" in app service to view the real time app logging. Now if you hit your web app with your client you should be able to see the why are you getting 401 unauthorized.

希望有帮助!

这篇关于使用Azure AD保护WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆