【发布时间】:2020-01-18 06:10:30
【问题描述】:
我有我的自定义控制器 "/my-endpoint" 和 spring 应用程序,配置如下:
@Override
public void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/my-endpoint", "/health")
.permitAll()
.antMatchers(DENY_RESOURCE_PATTERNS)
.denyAll()
.anyRequest()
.authenticated()
}
似乎对于一致的用户来说它工作正常。但是,如果我已经授权(使用 oauth2)并且我的会话(或令牌)已过期 -> spring 试图将我重定向到登录页面。
我不想要这个,我想允许任何用户连接到“/my-endpoint”端点。
我忘了配置什么?
有趣的是,内置端点 "/health" 按预期工作,即使会话已过期。
【问题讨论】:
-
my-endpoint是什么? -
@chaoluo,我的自定义控制器,它只是返回静态 json 对象
-
添加您要调用的确切 URL。
-
@DarrenForsythe, localhost:3030/my-endpoint
标签: spring spring-boot spring-security