10

我有一个受 Shibboleth 身份验证模块保护的 Web 应用程序。我当前的配置如下

<Location /MyApp>
 AuthType shibboleth
 ShibUseHeaders On
 ShibRequestSetting requireSession 1
 require shibboleth
</Location>

shibboleth是一个提供 SSO 功能的身份验证模块,当前流程将用户引导到身份提供者,以便用户输入登录凭据。我希望能够打开一个特定的 URL,以便 URL 被身份验证模块绕过。我尝试了以下方法,但它似乎不起作用,并且在加载 URL 时出现空白页

方法一

<Location /MyApp/Login.html>
  Satisfy Any
  Allow from all
  AuthType None
  Require all granted
</Location>

方法二

<Location /MyApp/Login.html>
  AuthType shibboleth
  ShibRequestSetting requireSession 0
  require shibboleth
</Location>

我做了一些额外的调试,似乎问题出在Login.html加载的其他文件上 - 例如 css、js 等。在 Apache 中配置它的正确方法是什么,以便可以绕过身份验证中的 Login.html

谢谢

4

2 回答 2

6

我最后关于排除Login.html加载的其他文件的评论最终是正确的。我使用以下格式排除了 html 文件正在加载的文件

<Location ~ "/MyApp/(Login.html|SessionTimeout.html|accessDenied.html|/badRequest.html|status|css/*|login/*|images/*|style/*|js/*|javascript/*|)">   
  Satisfy Any   
  Allow from all   
  AuthType None   
  Require all granted   
</Location>
于 2012-11-08T19:28:11.100 回答
1

当使用 Apache 2.4 而不是 2.2 时,为了排除“/server-status”,以下内容就足够了:

<LocationMatch "^(?!/server-status)">
    AuthType Basic
    AuthUserFile /etc/apache2/.htpasswd
    <RequireAll>
        Require ssl
        Require user valid_user_name
    </RequireAll>
</LocationMatch>

分析:

  • <LocationMatch "regex">相当于。_ _<Location ~ "regex">
  • 使用的正则表达式是pcre(perl 兼容的正则表达式)。
  • ^(?!/server-status)方法:
    • ^: “以。。开始”
    • (?!):“负面展望(而不是正面(?=))”
于 2020-12-14T05:22:45.110 回答