Search code examples
keycloakmicronaut

Micronaut keycloak


Dears,

Can anyone tell me which adapter to use with micronaut? i have server written on micronaut framework and keycloak up and running. For spring boot we use:

<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-spring-boot-starter</artifactId>
</dependency>

one more question: Can someone explain to me the flow how we can detect if a user already signed in using keycloak?


Solution

  • There is no official keycloak Micronaut adapter.

    You can try the default Micronaut support oauth2 / jwt.

    In this case, you will need to add these dependencies (and add their configuration properties):

     <dependency>
       <groupId>io.micronaut.security</groupId>
       <artifactId>micronaut-security</artifactId>
    </dependency>
    <dependency>
       <groupId>io.micronaut.security</groupId>
       <artifactId>micronaut-security-oauth2</artifactId>
    </dependency>
    <dependency>
       <groupId>io.micronaut.security</groupId>
       <artifactId>micronaut-security-jwt</artifactId>
    </dependency>
    

    A complete tutorial here: tutorial

    In another way, you can try this open source / community adapter looorent that I have never tried.

    (Always you can build your own module / extension).