【问题标题】:Apache Config - Exclude Location from AuthenticationApache Config - 从身份验证中排除位置
【发布时间】:2023-04-07 07:52:01
【问题描述】:

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

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

shibboleth 是一个提供 SSO 功能的身份验证模块,当前流程将用户引导至 Identity Provider 以供用户输入登录凭据。我希望能够打开一个特定的 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 可以绕过身份验证

谢谢

【问题讨论】:

    标签: apache authentication location single-sign-on shibboleth


    【解决方案1】:

    我最后关于排除 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>
    

    【讨论】:

      【解决方案2】:

      当使用 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>
      

      分析:

      • &lt;LocationMatch "regex"&gt;equivalent&lt;Location ~ "regex"&gt;
      • 正则表达式 usedpcre(与 perl 兼容的正则表达式)。
      • ^(?!/server-status) 表示:

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-05-10
        • 1970-01-01
        • 2016-03-12
        • 1970-01-01
        • 1970-01-01
        • 2022-08-24
        相关资源
        最近更新 更多