混合使用Azure AD身份验证和Forms身份验证

编程入门 行业动态 更新时间:2024-10-28 17:20:04
本文介绍了混合使用Azure AD身份验证和Forms身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个使用Forms身份验证的现有MVC5应用程序.我有一半的用户是Azure AD中也存在的内部员工.我想给他们选择针对AD进行身份验证的选项,但我不希望另一半通过AD.我所见过的所有使用Azure AD身份验证的示例似乎都是全有或全无.

I've got an existing MVC5 application that uses Forms authentication. Half of my users are internal employees that also exist in Azure AD. I'd like to give them the option to authenticate against AD but I don't want the other half to have to go through AD. All of the examples I've seen of using Azure AD authentication seems like an all or nothing thing.

我是否只能在登录表单中添加一个按钮,以便AD用户转到Azure登录并使用令牌重定向回去?我的另一个选择是,如果他们是Azure用户,请从我的登录表单中获取他们的电子邮件/密码,然后尝试使用它连接到AD.这似乎是一种风险,因为我将接触他们的实际网络凭据.

Can't I just add a button to my login form for the AD users to go to the Azure login and get redirected back with a token? My other option is if they are an Azure user, take their email/password from my login form and try to connect to AD with it. This seems like a risk as I'll have exposure to their actual network credentials.

推荐答案

我还没有完成它,但是我已经做得足够多了,这对我来说就像是解决方案.我将添加一个指向Azure AD用户的登录页面的链接,该链接指向此处定义的AD OpenID URL:

I haven't completed it yet but I've gotten far enough in that this feels like the solution to me. I'm going to add a link to my login page for Azure AD users that points to the AD OpenID url as defined here:

azure .microsoft/en-us/documentation/articles/active-directory-protocols-openid-connect-code/

我得到的id_token在解压后可以识别用户,如下所示:

The id_token that I get back identifies the user after it's unpacked as detailed here:

azure .microsoft/en-us/documentation/articles/active-directory-v2-tokens/#validating-tokens

更多推荐

混合使用Azure AD身份验证和Forms身份验证

本文发布于:2023-10-13 00:41:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1486322.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:身份验证   Azure   AD   Forms

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!