使用spring boot配置KeyClope

4ktjp1zp  于 2021-07-16  发布在  Java
关注(0)|答案(1)|浏览(443)

如何使用spring boot配置keydove以提供对某些资源的自由访问,同时使authorizationcontext在spring boot应用程序中可用(authorizationcontext仅在启用policy enforcer config时可用)?

2wnc66cl

2wnc66cl1#

通过使用策略实施器,您可以执行以下操作以拥有受保护和未受保护的端点:

keycloak.securityConstraints[0].authRoles[0]=user
keycloak.securityConstraints[0].authRoles[1]=admin
keycloak.securityConstraints[0].securityCollections[0].name=secure
keycloak.securityConstraints[0].securityCollections[0].patterns[0]=/secure
keycloak.securityConstraints[1].securityCollections[0].name=insecure
keycloak.securityConstraints[1].securityCollections[0].patterns[0]=/insecure

keycloak.policy-enforcer-config.enforcement-mode=PERMISSIVE
keycloak.policy-enforcer-config.paths[0].name=Secure Resource
keycloak.policy-enforcer-config.paths[0].path=/secure
keycloak.policy-enforcer-config.paths[1].name=Insecure Resource
keycloak.policy-enforcer-config.paths[1].path=/insecure
keycloak.policy-enforcer-config.paths[1].enforcement-mode=DISABLED

相关问题