azure - 针对 Azure AD 的主动身份验证
问题描述
早些时候,我们使用 AD 为我们的客户端启用了基于 ADFS 的主动身份验证。
我们通过以下 curl 命令实现了主动身份验证:
curl https://server.com/adfs/services/trust/13/usernamemixed --data @request.txt -H "Content-Type:application/soap+xml" --verbose -o "output.txt"。
这是我的 request.txt 文件
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
>
<s:Header>
<a:Action s:mustUnderstand="1">http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue</a:Action>
<a:To s:mustUnderstand="1">https://server.com/adfs/services/trust/13/usernamemixed</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2019-10-09T13:29:54Z</u:Created>
<u:Expires>2019-10-09T13:30:54Z</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-6a13a244-dac6-42c1-84c5-cbb345b0c4c4-1">
<o:Username>' . $user_name . '</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><![CDATA[' . $password . ']]></o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<trust:RequestSecurityToken xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
<wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<a:EndpointReference>
<a:Address>https://server.com/adfs/ls</a:Address>
</a:EndpointReference>
</wsp:AppliesTo>
<trust:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType>
<trust:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</trust:RequestType>
<trust:TokenType>urn:oasis:names:tc:SAML:2.0:assertion</trust:TokenType>
</trust:RequestSecurityToken>
</s:Body>
</s:Envelope>
现在我想在 Azure AD 上实现类似的主动身份验证,我想知道等效方法的方法。
有人可以对此有所了解吗?
干杯
解决方案
最相似的流程是 OAuth ROPC 流程:https ://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc 。
我建议您不要使用它,除非您正在迁移旧版应用程序。相反,如果可能,您应该使用以下流程之一:
- 授权码流程
- 隐式流
- 设备代码流
它们的优点是您的应用程序不需要处理密码。它们还与 ROPC 不兼容的 MFA 兼容。
推荐阅读
- java - 如何在应用程序启动时加载所有 webview 片段并且在用户导航时从不重新加载?
- java - Mockito doThrow() 不抛出异常
- ios - 在包标识符中使用两个字符串
- php - 文件名的高熵唯一 ID
- android - 更新firebasex插件后,离子cordova构建android失败
- python - 如何将 JSON 文件用作数组
- android - 我不能在 kotlin 中使用清除或删除功能
- javascript - marklogic javascript json json文档有命名空间吗
- python - Matplotlib 动画未显示使用 gridspec 绘制的图像
- javascript - 当一个对象中有多种数据类型时,如何在javascript中以我需要的格式获取数据?