• 请不要在回答技术问题时复制粘贴 AI 生成的内容
iszengmh
V2EX  ›  程序员

spring security5.0 如何才能让/**与/index.html 不冲突

  •  
  •   iszengmh · Nov 14, 2019 via Android · 1373 views
    This topic created in 2382 days ago, the information mentioned may be changed or developed.

    spring security5.0 如何才能让 /与 /index.html 不冲突,让所有路径需要权限,但是只开放 index.html,明明在 XML 中配置了<security:http pattern="/index.html" security="none"/>'但是在<security:http use-expression="false" entry-point-ref="ajaxAuthenticationPoint" auto-config="false"><security:intercept-url pattern="/" access="ROLE_USER"/>security:http/配置所有路径权限,导致 index 也无法访问了

    1 replies    2019-11-14 11:12:55 +08:00
    hantsy
        1
    hantsy  
       Nov 14, 2019
    好多年没见过 XML 配置了。

    按以下顺序设置试一下:

    1. pattern="/**" access="ROLE_USER"
    2. pattern="/index.html access 设置成匿名
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3046 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 08:37 · PVG 16:37 · LAX 01:37 · JFK 04:37
    ♥ Do have faith in what you're doing.