从PHP Web应用程序连接到Azure Active Directory

编程入门 行业动态 更新时间:2024-10-27 06:27:39
本文介绍了从PHP Web应用程序连接到Azure Active Directory的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

由于我真的很固执,因此寻求该主题的指导,我有一个使用PHP制作的应用程序的内部URL,并且我想连接到Azure Active Directory。

到目前为止,我已经审查了

构建URL将重定向到sso页面,登录后我们可以获取代码值,将在下一步中使用。

2,使用授权码请求访问令牌:

然后,我们可以使用访问令牌在请求的Authorization标头中将带有 Bearer标识的JWT字符串添加到资源Web API。

这里是 Azure提供的PHP测试项目,供您参考。

Seeking for guidance on the subject as I'm really stuck on this, I have a internal URL for an App made on PHP and I want to connect to Azure Active Directory.

So far I've reviewed an example from Microsoft using SimpleSAML but it's really outdated and I'm having troubles adapting it for the newer SimpleSAMl code.

Is there a better way to integrate a web application with Azure AD? I read somewhere that I may use Get started with Mobile Services but I would like to hear from previous experiences on what is the best/current method for using Azure AD for login on PHP?.

-- EDIT --

By integrate I mean to allow people authenticate and retrieve the email address or EmployeeID from the Azure AD to provide SSO support.

解决方案

There are several scenarios Azure AD supports, depend on what you use Azure AD for. Basically, to access the resources via Azure AD from PHP web application, you can refer to Web Application to Web API section to understand this scenario and get started.

To integrate Azure AD in PHP web applications, we need to follow authorization code grant flow steps to build several custom HTTP requests. E.G. To get access token via OAuth 2.0 protocol, we should refer to the steps on Authorization Code Grant Flow, generally, we will build 2 HTTP requests to get access token:

1,Request an authorization code

The build-up URL will redirect to the sso page, after login we can get the code value which will be used in next step.

2,Use the Authorization Code to Request an Access Token:

Then we can use the access token to add the JWT string with a "Bearer" designation in the Authorization header of the request to the resource web API.

Here is a PHP test project provided by Azure for your reference.

更多推荐

从PHP Web应用程序连接到Azure Active Directory

本文发布于:2023-11-01 17:33:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549963.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   应用程序   Web   PHP   Active

发布评论

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

>www.elefans.com

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