keycloak(转载)
2024-08-29 01:34:37
# 生成KEYSTORE.JKS
keytool -genkeypair -alias keycloak.me -keyalg RSA -keystore keycloak.jks -validity 10950
注意:CN必须是主机名,也可以是ip但是ip容易变,所以主机名或域名。后面访问的是时候通过在hosts 就文件映射域名到IP, 这里将CN 设置为keycloak.me, 注意alias参数不是设置CN的地方
生成好keycloak.jks 之后 复制到 keycloak-7.0.0\standalone\configuration\ 文件夹内
修改STANDALONE.XML 或 STANDALONE-HA.XML 或 DOMAIN.XML
具体修哪个文件,看你的安装方式,此处使用standalone.xml
在 下添加
<security-realm name="ApplicationRealm">
<server-identities>
<ssl>
<keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost" />
</ssl>
</server-identities>
<authentication>
<local default-user="$local" allowed-users="*" skip-group-loading="true" />
<properties path="application-users.properties" relative-to="jboss.server.config.dir" />
</authentication>
<authorization>
<properties path="application-roles.properties" relative-to="jboss.server.config.dir" />
</authorization>
</security-realm>
<!-- 添加的部分 -->
<security-realm name="UndertowRealm">
<server-identities>
<ssl>
<keystore path="keycloak.jks" relative-to="jboss.server.config.dir" keystore-password="openstack" alias="keycloak.me" />
</ssl>
</server-identities>
</security-realm>
<!-- 添加的部分 end -->
然后 搜索 <server name="default-server">
修改为如下内容,
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true" />
<!-- 修改https 的 security realm 为UndertowRealm, 默认为 ApplicationRealm-->
<https-listener name="https" socket-binding="https" security-realm="UndertowRealm" enable-http2="true" />
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content" />
<http-invoker security-realm="ApplicationRealm" />
</host>
</server>
重新启动 standalone.bat
修改HOST文件
添加
127.0.0.1 keycloak.me
访问https://keycloak.me:8443/auth
最新文章
- Difference Between HashMap and IdentityHashMap--转
- JMeter学习-037-JMeter调试工具之四-BeanShell+jmeter.log
- JVM性能调优监控工具jps、jstack、jmap、jhat、jstat、hprof使用详解
- [javascript svg fill stroke stroke-width rx ry ellipse 属性讲解] svg fill stroke stroke-width ellipse 绘制椭圆属性讲解
- sql2005 全文索引
- TP复习14
- dpkg的用法
- u-boot Makefile整体解析
- 背包问题递归java
- zoj 1938 Binomial Showdown 组合数裸基础
- Excel init
- SVN使用指引(Windows)
- [LeetCode] Shifting Letters 漂移字母
- 想要在launcher中模拟按home键。
- R语言-优化作图
- pandas.cut使用总结
- 1. windows 下redis数据库的安装
- 广州区块链系统or积分联盟
- Android 数据存储03之SQLite
- memory prefix un,under,uni out1