【发布时间】:2020-12-07 18:48:55
【问题描述】:
webapp: port : 7070 and docker: jboss/keycloak port:2020
keycloak.json
{
"realm": "abc",
"auth-server-url": "http://localhost:2020/auth/",
"ssl-required": "none",
"resource": "abcclient",
"public-client": true,
"confidential-port": 0
}
http://localhost:2020/auth/realms/abcWeb/.well-known/openid-configuration :可以在浏览器中看到输出但 error.org.keycloak.adapters.KeycloakDeployment.resolveUrls 无法从http://localhost:2020/auth/realms/abcWeb/.well-known/openid-configuration 加载 URL
keycloak 独立服务器: 有效的重定向网址 localhost:7070/* 基本/管理网址:localhost:2020/
在应用程序的 web.xml 中
<login-config>
<auth-method>KEYCLOAK</auth-method>
<realm-name>realmname</realm-name>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>webapp</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<!-- Security roles referenced by this web application -->
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>user</role-name>
</security-role>
*) 在 META_INF 中添加一个名为 (contex.xml) 的 xml 文件
<Context path="/path to your app">
<Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
</Context>
*) 构建并运行 () 请注意在 keycloak 中创建客户端时配置有效的返回 url 时要小心
【问题讨论】:
标签: java docker web-applications keycloak tomcat8