Conversation
|
Thanks for your effort on this PR. I am not going to details yet, becuase I'd like to discuss one topic first: Did you try to use/integrate the Symfony OidcHandler https://symfony.com/doc/current/security/access_token.html#using-openid-connect-oidc ? I am not really open to integrate new dependencies, especially for security related topics. Even more so, as that library didn't receive any commit in 10 months and has open topics for PHP 8.5. The last release was in September 2024. That is not really a reliable dependency. |
|
Personally I would expect Kimai to only provide the interfaces and possibilities to add new providers but the providers should come from plugins. |
|
Completely agree on the dependency point. I wasn’t aware that Symfony had OIDC support built-in. A plugin could make sense, but it has it be tied pretty deeply into the Symfony auth system to work. |
|
What I mean is that in my opinion this login authentication provider should not be part of Kimai Core but be provided as a plugin (if possible). |
|
The problem with everything auth related is that it needs changes in core config files. So shipping it as plugin would be ideal, but I am not sure how easy that actually is to achieve. Yes, I'd like to include the option for OIDC, but as said, with Symfony dependencies only. @matt-oakes are you willing to have a look at the Symfony own provider? |
I can only tell you what TYPO3 uses. TYPO3 has a Auth service chain (https://docs.typo3.org/permalink/t3coreapi:authentication-service-chain). It basically looks like this: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Services/UsingServices/ServiceChain.html#services-using-services-service-chain So you have a registry where you can register your own auth service provider and TYPO3 will iterate over them and check if the auth service provider can handle the request and if the auth was successful or not. For Kimai this could be an event listener where you can register your own service provider and Kimai then calls them. Each auth service provider needs to implement an interface (https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Services/Developer/ServiceApi.html) |
Description
This PR adds support for OpenID Connect (OIDC) authentication. It resolves #2469.
The code is heavily based on the existing SAML authentication implementation using:
OidcAuthenticatorto hook into Symfony authenticating usingPassport.OidcProviderto create and hydrate users.OidcControllerto supply the login routes to redirect to the configured OIDC provider.The implementation of OIDC in this PR is handled by
jumbojett/openid-connect-phpwhich does all of the heavy lifting.Configuration is very similar to SAML too, but much simplier because ODIC is more standardized and has sensible defaults. Basic configuration would be:
These are the only configuration values which need to be provided because OIDC is able to automatically detect the others using the "well known" URL. In the example above, it is able to access
https://auth.example.com/.well-known/openid-configuration. The response to this will include all of the URLs and other configuration needed to setup OIDC with that specific server.I have also gone a little further and implemented the same "role mapping" system which SAML has. You can configure this in a very similar way by adding this to the above config:
This works example the same as with SAML, however, the
attributeconfiguration value isn't needed as it is standarized in OIDC.Demo video
kimai_oidc.mp4
How to test this
To test this, you will need to have an OIDC authentication provider. There are many available such as Pocket ID, Ory Hydra, Authentik, VoidAuth, Keycloak, and Forgejo.
However, if you don't have any setup, then by far the easiest is to start a "demo instance" of Pocket ID (they last for 30 minutes before being deleted).
https://demo.pocket-id.org
When you have an instance you can follow these steps to create the required enviornment for testing:
To test role mapping:
admins.Types of changes
Checklist
composer code-check)