Hi there,
I'm trying to use keycloak (KC) for the first time for what i thought was a
basic use-case, but so far have been unsuccessful.
The issue is that when attempting to access a web app, after getting the login
screen and entering the user's credentials, i get a browser error stating that
it encountered too many redirections. Tried w/ both Firefox (72.0.2) and Chrome
(80.0.3987.106) w/ the same result.
The browser's debugger indeed shows after an initial POST to
session_code=SmcND-1YihFErInE3KkGb3U31Ebi7e9crQMsHgjZ-lo&\
execution=791afcdb-1093-4ddf-b85b-7401b7dace4c&\
client_id=YYY&\
tab_id=tPHfmCOQSWc
repeated sequences of the following 3 GET calls each ending w/ a 302 status...
response_type=code&\
client_id=YYY&\
redirect_uri=http%3A%2F%2Flocalhost%3A9090%2FYYY%2F&\
state=f69b3e68-6646-48bd-a077-ea38319a08ba&\
login=true&\
scope=openid
state=f69b3e68-6646-48bd-a077-ea38319a08ba&\
session_state=9288565f-b977-4865-8069-180154992995&\
code=f958667b-670e-4d0b-88a3-555a71b3e211.9288565f-b977-4865-8069-180154992995.055e1300-16c6-4ad9-b8bd-bf58b533c692
While the 'session_state' parameter's value remain the same, those of 'state'
and 'code' change w/ every triplet instance.
The setup i'm using is as follows:
* Java (Oracle) - java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode),
* Keycloak - Version 8.0.2, and following getting started instructions [1] for
creating a new realm, client and user,
* Tomcat - version 9.0.30, w/ the added adapter JARs from [2],
* Java web-app - version 3.1, with the following added to its web.xml as per [3]
...
<security-constraint>
<web-resource-collection>
<web-resource-name>Customers</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>user</role-name>
</security-role>
...
* keycloak.json:
{
"realm": "demo",
"ssl-required": "external",
"resource": "YYY",
"public-client": true,
"confidential-port": 0
}
* created a 'user' role in KC --tried both a realm role as well as a client one
but result remained the same.
any thoughts or feedback about sorting out this issue is much appreciated. TIA.
cheers;