如何在 Apache 中接受多个身份验证选项?

Jam*_*sen 7 authentication openid cas apache-2.2

我想保护 VirtualHost 中的路径,但允许用户使用多种身份验证选项(例如mod-auth-cas,mod-auth-openidmod-auth-digest。)如何设置虚拟主机定义以允许auth-type同一位置有多个s?

out*_*tis 5

多种身份验证类型的问题在于它们往往具有不可调和的协议。您可以尝试Shibboleth 文档中显示的技术,将所有内容放在一个子目录中,为要支持的每种身份验证类型创建指向该目录的符号链接,然后为不同的身份验证类型配置每个符号链接位置。

<Location /basic>
    AuthType Basic
    AuthUserFile /path/to/.htpasswd
    require valid-user
</Location>
<Location /cas>
    AuthType CAS
    require valid-user
</Location>
<Location /openid>
    AuthOpenIDEnabled On
    require valid-user
</Location>
Run Code Online (Sandbox Code Playgroud)


小智 5

我遇到了几乎相同的情况,解决如下:

在服务器配置级别,在 apache2.conf 中(假设基于 Debian 的发行版)

<AuthnProviderAlias method1 auth1_name  >
# config options
# ...
</AuthnProviderAlias>

<AuthnProviderAlias method2 auth2_name  >
# config options
# ...
</AuthnProviderAlias>
Run Code Online (Sandbox Code Playgroud)

在虚拟主机特定的conf文件中:

<VirtualHost *>
# config options
# ...

<Location /your_location>
# config options
AuthBasicProvider auth1_name auth2_name
# other needed config options
# ...
</Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

通过这种方式,您可以在同一 Location 指令中为不同的 VirtualHost 使用不同名称的不同授权/身份验证方法

我的解决方案的更多细节在一篇简短的博客文章中:链接文本

HTH,再见:)吉安卢卡


小智 2

你尝试过“满足任何人”吗?