GitHub SSO / OAuth2

To enable GitHub SSO in the application, you'll first have to enable OAuth2 in micronaut:

micronaut:
  security:
    enabled: true
    oauth2:
      enabled: true
      clients:
        github:
          client-id: "<client-id>"
          client-secret: "<client-secret>"
          scopes:
            - user:email
            - read:user
          authorization:
            url: https://github.com/login/oauth/authorize
          token:
            url: https://github.com/login/oauth/access_token
            auth-method: client-secret-post

You can also override the GitHub API url if needed. Default value is https://api.github.com

github.api.url: https://override.api.github.com

To further tell AKHQ to display GitHub SSO options on the login page and customize claim mapping, configure Oauth in the AKHQ config:

akhq:
  security:
    default-group: no-roles
    oauth2:
      enabled: true
      providers:
        github:
          label: "Login with GitHub"
          username-field: login
          users:
            - username: franz
              groups:
                # the corresponding akhq groups (eg. topic-reader/writer or akhq default groups like admin/reader/no-role)
                - topic-reader
                - topic-writer

The username field can be any string field, the roles field has to be a JSON array.

References

https://micronaut-projects.github.io/micronaut-security/latest/guide/#oauth2-configurationopen in new window