I’m trying to integrate Keycloak 25 with WildFly 26, but I’m facing an issue where my application is supposed to redirect to the Keycloak login page for authentication. Instead, I’m getting a 403 Forbidden error.
In the logs, I see the following warning:
**WARN [org.wildfly.security.http.oidc] (default task-1) ELY23005: Unable to load OpenID provider metadata from http://localhost:8080/realms/My_Realm/.well-known/openid-configuration
**
However, when I manually access this URL in the browser, I get a valid JSON response.
Here are the relevant configuration details:
Standalone.xml:
<subsystem xmlns="urn:wildfly:elytron-oidc-client:1.0">
<secure-deployment name="gui_QA.war">
<client-id>My_Realm</client-id>
<provider-url>http://localhost:8080/realms/My_Realm</provider-url>
<ssl-required>NONE</ssl-required>
<credential name="secret" secret="..." />
</secure-deployment>
</subsystem>
web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>app</web-resource-name>
<url-pattern>/index1.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>MY_ROLE</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>OIDC</auth-method>
<realm-name>My_Realm</realm-name>
</login-config>
<security-role>
<role-name>MY_ROLE</role-name>
</security-role>
oidc.json:
{
"realm": "My_Realm",
"auth-server-url": "http://localhost:8080/realms/My_Realm",
"ssl-required": "none",
"resource": "gui_QA",
"credentials": {
"secret": "..."
},
"confidential-port": 0,
"use-resource-role-mappings": true,
"principal-attribute": "preferred_username",
"public-client": false,
"bearer-only": false
}
I’ve been stuck on this for two days and can’t figure out why it’s not working. Any help would be greatly appreciated!