V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Kevinyy
V2EX  ›  Java

请教一个关于 Spring-Security 开放 URL 白名单问题

  •  
  •   Kevinyy · Sep 20, 2022 · 2823 views
    This topic created in 1317 days ago, the information mentioned may be changed or developed.

    问题描述:项目中有这样一个需求,利用 Nacos 配置中心,可以在项目运行后动态更改的 URL 白名单,不需要鉴权直接放行。目前鉴权使用的是 Spring-Security 框架,项目本身是 SpringBoot 单体项目。各位大佬能指点迷津。

    3 replies    2022-09-21 10:07:25 +08:00
    2020beBetter
        1
    2020beBetter  
       Sep 20, 2022
    https://blog.csdn.net/L_zsen/article/details/118517148

    这个博主,不就满足你的需求?
    aboat365
        2
    aboat365  
       Sep 21, 2022
    Spring-Security 动端权限,只需要自定义写个 AccessDecisionVoter 接口实现即可,详细鉴权逻辑内容在 vote 方法中。
    frank1256
        3
    frank1256  
       Sep 21, 2022
    1 、nacos 动态刷新,最简单的配合 @value 注解即可。用 @value 注解一个 list 类型 property ,eg:whiteList ,要配置 RefreshScope
    2 、security 配置 http.pathMatchers(ArrayUtil.toArray(whiteList)).permitAll()
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3225 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 11:59 · PVG 19:59 · LAX 04:59 · JFK 07:59
    ♥ Do have faith in what you're doing.