KeycloakUserProvider: ClassCastException for StandardLogin to SSOLogin
Hi,
I am trying to use the KeycloakUserProvider in the CIB Seven webclient. I could easily configure the integrated camunda web client via the SPRING_SECURITY_OAUTH2_CLIENT which worked for me. Now I am trying to do the same for the new CIB Seven webclient via CIBSEVEN_WEBCLIENT. But when i try to log in I get the following error:
java.lang.ClassCastException: class org.cibseven.webapp.auth.rest.StandardLogin cannot be cast to class org.cibseven.webapp.auth.sso.SSOLogin (org.cibseven.webapp.auth.rest.StandardLogin and org.cibseven.webapp.auth.sso.SSOLogin are in unnamed module of loader org.springframework.boot.loader.launch.LaunchedClassLoader @3e3abc88)
Is my configuration invalid or do I miss something?
This is my docker-compose.yaml file with my custom configuration:
version: '3.8'
services:
cibseven:
image: cibseven/cibseven:run-2.1.0-SNAPSHOT
container_name: cibseven
command: ["./cibseven.sh", "--oauth2", "--webapps", "--example", "--rest"]
ports:
- "8080:8080"
depends_on:
- postgres
environment:
# Database configuration
- DB_DRIVER=org.postgresql.Driver
- DB_URL=jdbc:postgresql://postgres:5432/cibseven
- DB_USERNAME=cibseven
- DB_PASSWORD=cibseven
- DB_SCHEMA=public
# OAuth2 configuration for camunda webclient (working)
- SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_PROVIDER=keycloak
- SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_CLIENT_ID=test-cib-seven
- SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_CLIENT_SECRET=<SECRET>
- SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_SCOPE=openid,profile,email
- SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_AUTHORIZATION_GRANT_TYPE=authorization_code
- SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_KEYCLOAK_REDIRECT_URI=http://0.0.0.0:8080/login/oauth2/code/test-cib-seven
- SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KEYCLOAK_ISSUER_URI=https://<MY_DOMAIN>/realms/<MY_REALM>
# OAuth2 configuration for CIB Seven webclient (not working)
- CIBSEVEN_WEBCLIENT_USER_PROVIDER=org.cibseven.webapp.auth.KeycloakUserProvider
- CIBSEVEN_WEBCLIENT_SSO_ENDPOINTS_TOKEN=https://<MY_DOMAIN>/realms/<MY_REALM>/protocol/openid-connect/token
- CIBSEVEN_WEBCLIENT_SSO_ENDPOINTS_JWKS=https://<MY_DOMAIN>/realms/<MY_REALM>/protocol/openid-connect/certs
- CIBSEVEN_WEBCLIENT_SSO_ENDPOINTS_USER=https://<MY_DOMAIN>/realms/<MY_REALM>protocol/openid-connect/userinfo
- CIBSEVEN_WEBCLIENT_SSO_CLIENTID=test-cib-seven
- CIBSEVEN_WEBCLIENT_SSO_CLIENTSECRET=<SECRET>
- CIBSEVEN_WEBCLIENT_SSO_USERIDPROPERTY=id
- CIBSEVEN_WEBCLIENT_SSO_USERNAMEPROPERTY=preferred_username
- CIBSEVEN_WEBCLIENT_AUTHENTICATION_JWTSECRET=<SECRET>
postgres:
image: postgres:14
container_name: cibseven-postgres
ports:
- "5432:5432"
environment:
- POSTGRES_USER=cibseven
- POSTGRES_PASSWORD=cibseven
- POSTGRES_DB=cibseven
volumes:
- postgres-data:/var/lib/postgresql/data
command: postgres -c max_connections=100 -c shared_buffers=256MB
volumes:
postgres-data: