嵌入式Keycloak和Spring Boot应用程序的默认配置 [英] default configuration with embedded keycloak and spring boot app

查看:116
本文介绍了嵌入式Keycloak和Spring Boot应用程序的默认配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用嵌入式Keycloak和Spring Boot应用程序
我创建了一个领域,然后创建了一个具有以下内容的客户端:
访问类型:机密
已启用授权:已启用
然后我创建了具有权限和政策的资源
我的问题是:
我想将此配置导出到配置文件(java config或json config)中,这样就不必每次重新启动keycloak服务器时都必须在开始时配置keycloak

I'm working with embedded keycloak and spring boot app
I created a realm then I created a client with:
Access Type: confidential
Authorization Enabled: enabled
then I created resources with permission and policy
My problem is :
I want to export this configuration in a config file (java config or json config) so that not every time I have to configure keycloak at the beginning when I restart my keycloak server

我该怎么做?

推荐答案

您可以使用

You can import/export the realm using the Keycloak Admin REST API. To import use the endpoint:

POST <KEYCLOAK_HOST>/auth/admin/realms/<REALM_NAME>/partialImport

并提供领域的 JSON 表示形式.您可以通过点击 Realm >并通过管理控制台API获得该表示.导出>导出.或使用端点:

and provide the JSON representation of the realm. That representation you can get via Admin Console API by click on Realm > Export > Export. Or using the endpoint:

POST <KEYCLOAK_HOST>/auth/admin/realms/<REALM_NAME>/partial-export?exportClients=true&exportGroupsAndRoles=true

或者,对于导出/导入,您可以使用:

Alternatively, for the export/import you can use:

POST <KEYCLOAK_HOST>/auth/admin/realms

GET <KEYCLOAK_HOST>/auth/admin/realms/<REALM_NAME>

分别.

但是随后您将需要分别导出/导入客户端:

But then you will need to export/import the clients separately:

GET <KEYCLOAK_HOST>/auth/admin/realms/<REALM_NAME>/clients

POST <KEYCLOAK_HOST>/auth/admin/realms/<REALM_NAME>/clients

并提供客户端的 JSON 表示形式.

and provide the JSON representation of the clients.

这篇关于嵌入式Keycloak和Spring Boot应用程序的默认配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆