V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
iszengmh
V2EX  ›  程序员

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

  •  
  •   iszengmh · 2019 年 11 月 14 日 via Android · 1286 次点击
    这是一个创建于 2339 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 条回复    2019-11-14 11:12:55 +08:00
    hantsy
        1
    hantsy  
       2019 年 11 月 14 日
    好多年没见过 XML 配置了。

    按以下顺序设置试一下:

    1. pattern="/**" access="ROLE_USER"
    2. pattern="/index.html access 设置成匿名
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1282 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 17:21 · PVG 01:21 · LAX 10:21 · JFK 13:21
    ♥ Do have faith in what you're doing.