Application.properties:
server.port=8180
keycloak.realm = finaltest
keycloak.auth-server-url = http://localhost:8080/auth
keycloak.resource = ex
keycloak.public-client=false
keycloak.enabled=true
keycloak.credentials.secret=secret
keycloak.ssl-required = external
keycloak.cors=true
keycloak.use-resource-role-mappings=true
keycloak.security-constraints[0].auth-roles[0]=master
keycloak.security-constraints[0].security-collections[0].patterns[0]=/*
keycloak.policy-enforcer-config.enforcement-mode=ENFORCING
keycloak.policy-enforcer-config.lazy-load-paths=true
资源: 我有两个资源 http://localhost:8180/flights.html http://localhost:8180/hotels.html 我已经使用keycloak管理控制台中的策略保护了这些策略。如何在应用程序中实施这些策略?
答案 0 :(得分:1)
keycloak.policy-enforcer-config.enforcement-mode =强制执行此行将强制执行策略。但是您必须具有Spring Boot 2.0及更高版本。