从PHP Web应用程序连接到Azure Active Directory [英] Connect to Azure Active Directory from PHP web application

查看:119
本文介绍了从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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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