V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iszengmh
V2EX  ›  程序员

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

  •  
  •   iszengmh · 2019-11-14 11:01:42 +08:00 via Android · 1024 次点击
    这是一个创建于 1617 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 11:12:55 +08:00
    好多年没见过 XML 配置了。

    按以下顺序设置试一下:

    1. pattern="/**" access="ROLE_USER"
    2. pattern="/index.html access 设置成匿名
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1341 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:43 · PVG 07:43 · LAX 16:43 · JFK 19:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.