【问题标题】:SavedRequestAwareAuthenticationSuccessHandler doesn't work if URL is opened from MS Excel如果从 MS Excel 打开 URL,SavedRequestAwareAuthenticationSuccessHandler 不起作用
【发布时间】:2017-07-11 14:28:15
【问题描述】:

我已经将SAMLAzure ADSpring Security/Spring Security SAML 集成在一起。 URL 类似于https://<server>/report/123,Spring Security 在通过 SAML 成功验证后很好地重定向到它。

问题是当我的用户通过 MS Excel 单击 URL 时 - 保存的请求不再起作用。我发现 MS Office 在打开的“目录”上以 HTTP OPTIONS 开头,并排除了 Spring Security http 元素中为选项请求的 URL,试图避免任何干扰:

<security:http pattern="/reports/.*/" path-type="regex" security="none" />

<security:http pattern="/reports/.*/.*" authentication-manager-ref="samlAuthenticationManager" path-type="regex">
    <security:intercept-url pattern="**" access="ROLE_ACCESS_REPORTS_URL"/>
    <security:form-login login-page="/loginReports" login-processing-url="/reports/login"
                authentication-failure-handler-ref="reportsSecurityExceptionTranslationHandler"
                authentication-details-source-ref="authenticationDetailsSource"/>
    <security:remember-me key="xxx" services-ref="rememberMeServices" />
    <security:custom-filter after="BASIC_AUTH_FILTER" ref="samlFilter"/>
</security:http>

仍然没有成功。有什么想法吗?

【问题讨论】:

    标签: spring-saml


    【解决方案1】:

    可能对某些人有用(HTTP OPTIONS 与此无关):

    1. MS Excel(不是浏览器)使用包含“ms-office”的用户代理打开正确的 URL。它会重定向到登录页面
    2. MS Excel 在浏览器中打开登录页面。此时有关请求的 URL 的所有信息都将丢失
    3. 登录过程
    4. ...

    https://serverfault.com/questions/588604/office-for-mac-hyperlinks-that-redirect-to-https-fail-to-load-with-unable-to-op 的启发,在 nginx 中添加一个重定向规则,如果用户代理包含“ms-office”,则该规则始终返回 200。这是一个 hack,但可以正常工作,因为 Office 现在正在浏览器中打开请求的 URL,并且浏览器会获得适当的重定向。

    【讨论】:

      猜你喜欢
      • 2014-07-02
      • 2012-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-06
      • 1970-01-01
      相关资源
      最近更新 更多