谁能建议如何验证JWT令牌(来自可实现的源,而不是过期)?
发布于 2022-09-27 10:16:03
实现ServerSecurityContextRepository
并重写Mono<SecurityContext> load(ServerWebExchange exchange)
方法。然后从ServerWebExchange
中提取令牌并执行验证。
若要使用自定义安全上下文,请执行以下操作:
@Configuration
@EnableWebFluxSecurity
@EnableReactiveMethodSecurity
@RequiredArgsConstructor
public class BaseSecurityConfig implements WebFluxConfigurer {
protected final ServerSecurityContextRepository serverSecurityContextRepository;
protected ServerHttpSecurity basicSecurity(ServerHttpSecurity http) {
return http.securityContextRepository(serverSecurityContextRepository)
...
}
}
https://stackoverflow.com/questions/73865384
复制相似问题