只有在主动提供客户端的情况下,才能将基于身份validation的不同types的apache auth提供程序组合在一起

我希望能够在apache服务器(ub16上的2.4.18+)上使用主要通过使用SAML(使用mod_auth_mellon插件)进行身份validation的path进行交互式使用,同时也支持主叫方先发送基本身份validation证书。 (认为​​通常会触发交互式表单login的REST API端点,但是如果您预先发送基本authentication凭据,则允许绕过。

基本上我正在寻找这种行为:

  • 如果信用与请求一起发送:
    • 尝试一下,如果他们工作,允许请求
  • 如果上述信用失败,或者没有提供
    • 触发首选身份validation插件。

这样的事情可能吗? 我宁愿不把它推回到应用程序本身。

我不希望发生的事情是,Apache服务器发回响应,触发基本身份validation对话框。

回答我自己的问题….挖掘这个更多,并提出以下这似乎工作:

<Location /> <If "-n req('Authorization')"> AuthName "Active Directory" AuthBasicProvider ldap AuthType basic AuthLDAPMaxSubGroupDepth 0 AuthLDAPBindAuthoritative off AuthLDAPRemoteUserAttribute sAMAccountName AuthLDAPInitialBindPattern (.+) $1@yyyyy AuthLDAPInitialBindAsUser on AuthLDAPSearchAsUser on AuthLDAPCompareAsUser on AuthLDAPUrl "ldaps://xxx,dc=com?sAMAccountName,memberOf?sub" LDAPReferrals Off require valid-user </If> <Else> Require valid-user AuthType "Mellon" MellonEnable "auth" MellonVariable "cookie" MellonEndpointPath "/sso" MellonDefaultLoginPath "/" MellonSubjectConfirmationDataAddressCheck Off MellonSessionLength 86400 MellonSPPrivateKeyFile /...../sp-private-key.pem MellonIdPMetadataFile /...../idp-metadata.xml MellonDoNotVerifyLogoutSignature https://........ </Else> </Location> 

有人看到这个方法有什么问题吗?