首页 > 解决方案 > 针对 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 上实现类似的主动身份验证,我想知道等效方法的方法。

有人可以对此有所了解吗?

干杯

标签: azureauthenticationactive-directoryazure-active-directory

解决方案


最相似的流程是 OAuth ROPC 流程:https ://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc 。

我建议您不要使用它,除非您正在迁移旧版应用程序。相反,如果可能,您应该使用以下流程之一:

  • 授权码流程
  • 隐式流
  • 设备代码流

它们的优点是您的应用程序不需要处理密码。它们还与 ROPC 不兼容的 MFA 兼容。


推荐阅读