【发布时间】:2022-07-07 16:55:13
【问题描述】:
我有一个将 Flowable Open Source 作为模块的应用程序。为了在 keycloak 中使用我的角色和用户,flowable IDM 与 keycloak 与此配置集成。
....
flowable:
common:
app:
idm-admin:
user: <user>
password: <password>
security:
type: oauth2
o-auth2:
authorities-attribute: groups
groups-attribute: ${IAM_USERGROUP:userGroups}
idm:
app:
keycloak:
enabled: false
server: ${ISSUER_URL:http://localhost:8080/auth/realms/my-realm}
authentication-realm: master
authentication-user: ${IAM_AUTHUSER:admin}
realm: ${IAM_REALM:my-realm}
authentication-password: ${IAM_AUTHPASS:admin}
....
现在我的问题是,当我登录主应用程序时,我已经拥有必要的角色,但是当用户尝试使用可流动模块时,它会将用户重定向到登录页面,就好像用户没有经过身份验证或授权一样还没有。
这是我对包含 flowable 的微服务的安全配置
http
.requestMatchers()
.antMatchers("/actuator/**")
.and()
.authorizeRequests()
.antMatchers("/actuator/**").permitAll()
.and()
.requestMatchers()
.antMatchers("/graphql/**")
.and()
.authorizeRequests()
.anyRequest().authenticated()
.and()
.oauth2Login(oauthLogin -> oauthLogin.permitAll()) //redirect to login if no token or session is provided
.oauth2ResourceServer().jwt(); //validate JWT Bearer token
http.logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/app/logout"))
.logoutSuccessHandler(keycloakLogoutHandler);
仅针对安全性定制的执行器和 graphql 端点。所以基本上我将所有身份验证和授权配置留给可流动的类。我在这里做错了什么?
版本 弹簧靴 2.6.2
flowable-spring-boot-starter 6.7.2
【问题讨论】:
标签: spring-boot spring-security keycloak flowable