OidcPrincipal in WildFly for Keycloak Authz Client Policy Enforcer

Hi,

I’m trying to secure some resources with UMA Authorization Services. I’ve added the Maven dependency for keycloak-authz-client but have been getting some OIDC errors trying to run the Policy Enforcement Filter in a WAR. I have a keycloak.json and a policy-enforcer.json in my WEB-INF folder. The app starts up without errors.

I’m getting the following error when I try to hit one of my endpoints

UT005023: Exception handling request to /uma-demo/api/uma-protected/uma-secret-message: java.lang.ClassCastException: class org.wildfly.security.auth.principal.NamePrincipal cannot be cast to class org.wildfly.security.http.oidc.OidcPrincipal (org.wildfly.security.auth.principal.NamePrincipal is in unnamed module of loader 'org.wildfly.security.elytron-base@2.6.0.Final' @2b9627bc; org.wildfly.security.http.oidc.OidcPrincipal is in unnamed module of loader 'deployment.uma-demo-1.0-SNAPSHOT.war' @29e2ab66)

As far as WildFly goes, there’s a working OAuth2 Realm. Prior to adding the Keycloak client, I had RBAC working with a JWTHTTPAuthenticator.

Thanks,
Carl