jhipster - 如何在 jhipster 应用程序中为 keycloak 指定策略执行器?

标签 jhipster keycloak

即使在创建过程中选择 Oauth2 授权,

Jhipster 应用程序也没有 keycloak.json 文件。但是official Keycloak 文档告诉我们在 keycloak.json 中指定 policy-enforcer 属性。任何有关应在何处指定的线索都将受到高度赞赏。

我的application.yml文件:-

security:
basic:
    enabled: false
oauth2:
    client:
        access-token-uri: http://localhost:9080/auth/realms/jhipster/protocol/openid-connect/token
        user-authorization-uri: http://localhost:9080/auth/realms/jhipster/protocol/openid-connect/auth
        client-id: web_app
        client-secret: web_app
        client-authentication-scheme: form
        scope: openid profile email
    resource:
        filter-order: 3
        user-info-uri: http://localhost:9080/auth/realms/jhipster/protocol/openid-connect/userinfo
        token-info-uri: http://localhost:9080/auth/realms/jhipster/protocol/openid-connect/token/introspect
        prefer-token-info: false

我的 keycloak.yml 和 app.yml 文件均未更改。

最佳答案

策略执行是 Keycloak specific :

Policy Enforcement Point (PEP) is a design pattern and as such you can implement it in different ways. Keycloak provides all the necessary means to implement PEPs for different platforms, environments, and programming languages. Keycloak Authorization Services presents a RESTful API, and leverages OAuth2 authorization capabilities for fine-grained authorization using a centralized authorization server.

enter image description here

Oauth2 规范中没有这样的功能。 Jhipster 根据 Oauth2 标准生成您的项目,您可以基于此进行 keycloak 集成,但无法使用其特定功能。为了让它工作,您需要使用 KC specific adapters并摆脱 Jhipster 的 Oauth2 自动配置。

其他解决方案可能涉及扩展 Jhipster 添加的代码(我相信它基于 Spring Security Oauth plugin ),以便使用此 KC 功能来扩展它。您需要自己编写敏感代码,所以我宁愿采用第一种方法。

关于jhipster - 如何在 jhipster 应用程序中为 keycloak 指定策略执行器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51036128/

相关文章:

当角色数量达到数百时,Keycloak 重定向失败

client - 如何在Keycloak中配置限时用户客户端访问?

JHipster模块 Hook 错误

java - Jhipster:上下文路径更改在管理部分显示错误

mysql - Jhipster 消耗大量资源

jhipster - 在 JHipster Angular 2 应用程序中从本地系统添加自定义 JS 文件

docker - docker 网桥模式下的 Keycloak 授权 : how to access localhost?

java - Keycloak - antMatcher 与请求的路径 Java 不匹配

spring-security - Vaadin 23 Spring Security with Keycloak - 登录后将用户重定向到正确的页面

java - 无法将服务注入(inject) Spring 测试