Search code examples
javayamlkeycloakquarkus

Quarkus keycloak config not workin. quarkus.keycloak.policy-enforcer.enable=true not working in .yaml representation


I am using the io.quarkus:quarkus-keycloak-authorization quarkus extension and want to use the AuthzClient. The official documentation tells us that one must set the configuration parameter quarkus.keycloak.policy-enforcer.enable to true. If one uses an application.properties file this works like a charm. But if I change to a application.yaml the setting is not recognized anymore.

application.properties:

quarkus.keycloak.policy-enforcer.enable=true
quarkus.keycloak.policy-enforcer.paths.default.path=/public/*
quarkus.keycloak.policy-enforcer.paths.default.enforcement-mode=DISABLED

application.yaml

quarkus:
    keycloak:
        policy-enforcer:
            enable: true
                paths:
                    default:
                        path: /public/*
                        enforcement-mode: disabled

How can I set up the application.yaml to work like my application.properties config file?


Solution

  • So the solution was very straightforwar. Other than Spring Boot, Quarkus does not support YAML configuration files out of the box so you need to add the extension quarkus-config-yaml.

    pom.xml:

    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-config-yaml</artifactId>
    </dependency>
    

    build.gradle.kts:

    implementation("io.quarkus:quarkus-config-yaml")