Skip to content

Custom auth flow support and OAuth2/OIDC plugin - #194

Open
intelfx wants to merge 23 commits into
pikvm:masterfrom
intelfx:work/oauth
Open

intelfx wants to merge 23 commits into
pikvm:masterfrom
intelfx:work/oauth

Conversation

@intelfx

@intelfx intelfx commented Jun 17, 2025

Copy link
Copy Markdown
Member

Preliminary implementation of a pluggable authentication flow architecture, with the OAuth/OAuth2 backend as the first user thereof.

Credits: #156


This implementation accepts configuration under the kvmd.auth.flows.oauth key, as follows:

kvmd:
  auth:
    flows:
      oauth:
        enabled: true
        providers:
          github:
            type: oauth2
            client_id: myclient
            client_secret: mysecret123
            access_token_url: https://github.com/login/oauth/access_token
            authorize_url: https://github.com/login/oauth/authorize
            base_url: https://github.com/
            user_info_url: https://api.github.com/user
            short_name: GitHub
            long_name: GitHub
            scope: openid user
            username_attribute: email
          keycloak:
            type: oauth2
            client_id: client2
            client_secret: str
            access_token_url: https://sso.keycloak.my.tld/realms/master/protocol/openid-connect/token
            authorize_url: https://sso.keycloak.my.tld/realms/master/protocol/openid-connect/auth
            base_url: https://sso.keycloak.my.tld/
            user: https://sso.keycloak.my.tld/realms/master/protocol/openid-connect/
            short_name: Keycloak
            long_name: My Keycloak
            scope: openid profile
            username_attribute: sub

UI-wise, each provider corresponds to a separate button on the login page which triggers the corresponding auth flow.

API-wise, the new APIs are located under /api/auth/flow/oauth/{key}. The name of a section under kvmd.auth.flows.oauth.providers (e.g., github or microsoft) is an arbitrary URL-safe string, and it is used as the {key} in the base URL above.

The callback URL will be {pi-kvm}/api/auth/flow/oauth/{key}/callback. You will have to whitelist that URL in the OAuth authorization server in use.

@intelfx
intelfx marked this pull request as ready for review November 13, 2025 12:00
@intelfx
intelfx force-pushed the work/oauth branch 6 times, most recently from b25f491 to af1ed06 Compare November 13, 2025 13:39
@intelfx intelfx changed the title Draft: OAuth OAuth Manager and OAuth2/OpenID connect Plugin (from #156) Custom auth flow support and OAuth2/OIDC plugin Nov 13, 2025
@dgtlrift

dgtlrift commented Jul 8, 2026

Copy link
Copy Markdown

This would be of great use. When can this PR be approved?

@cln-io

cln-io commented Jul 24, 2026

Copy link
Copy Markdown

I would love to use this! could we get the PR looked at? <3

@intelfx

intelfx commented Jul 24, 2026

Copy link
Copy Markdown
Member Author

This will eventually happen, sorry everyone. We are all exceedingly busy with work on upcoming features and products.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants