Skip to content

feat: added oidc issuer flag #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat: added oidc issuer flag #28

wants to merge 2 commits into from

Conversation

puffitos
Copy link
Member

Motivation

This makes the prometheus-auth more flexible, in case a non-caas OIDC issuer should be used.

Changes done

The provider URL is now passed directly via a CLI flag. There is validation done directly, in case a URL should be passed.

To make sure that no OIDC Issuers with a URL of "" are used (the nil value of the CLI string when a flag isn't provided), a simple struct named oidc was introduced, with an active property, which is only set, if the issuer URL passed can be actually parsed.

Discussion

To accommodate this change, the switch statement was replaced with multiple ifs. This was in case the user hasn't provided an Issuer URL and in case the claim should have an empty Issuer URL (which shouldn't happen according to the RfC https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1, but wilder things have happened). Just playing it safe should be OK, I guess and we're not sacrificing too much readability here.

Tests done

Tested in an rke1 and rke2 staging cluster with different OIDC Issuer URLs. The validation works as it did before.

puffitos added 2 commits June 23, 2025 14:53
Signed-off-by: Bruno Bressi <[email protected]>
This commit refactors the code and introduces a new feature to actually
validate the OIDC iss URI. This is done as to avoid empty URLs, which
shouldn't happen, but better to be safe than sorry.
@puffitos puffitos requested review from y-eight and CerRegulus June 23, 2025 14:33
@puffitos puffitos self-assigned this Jun 23, 2025
@puffitos puffitos added the enhancement New feature or request label Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant