繁体   English   中英

Keycloak 和自定义身份验证过滤器

[英]Keycloak and custom authentication filter

我们使用自定义身份验证过滤器检查不记名令牌以限制对 /api 的访问
此外,我们允许对 /anonymous 的所有请求
现在我们需要通过不记名令牌为 /admin 添加 keycloak 授权
我尝试了很多变体,但似乎没有一种在所有 3 种方式中都有效
任何人都可以帮助配置应该是什么样子吗?

现在 configure() 方法看起来像

http
            .cors()
            .and()
            .csrf()
            .disable()
            .exceptionHandling()
            .authenticationEntryPoint(unauthorizedHandler)
            .and()
            .sessionManagement()
            .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
            .and()
            .authorizeRequests()
            .antMatchers("/anonymous/**").permitAll()
            .anyRequest()
            .authenticated();

http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM