Skip to content
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

backend: Autogenerate default oidc-valid-redirect-urls #541

Merged
merged 2 commits into from
Jan 11, 2022

Conversation

yolossn
Copy link
Contributor

@yolossn yolossn commented Dec 20, 2021

This patch improves the help string of
oidc-valid-redirect-urls by adding explanation
for wildcard support.

Signed-off-by: Santhosh Nagaraj S [email protected]

@yolossn yolossn requested a review from joaquimrocha December 20, 2021 04:35
@yolossn yolossn linked an issue Dec 20, 2021 that may be closed by this pull request
Copy link
Collaborator

@joaquimrocha joaquimrocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to be clarified, yet the string can be improved as it's more suggestive than it should, IMO. How about:
OIDC valid Redirect URLs; accepts comma separated values and supports wildcards (*), for example http://nebraska.example.io/*

This patch improves the help string of
oidc-valid-redirect-urls by adding explanation
for wildcard support.

Signed-off-by: Santhosh Nagaraj S <[email protected]>
@yolossn yolossn force-pushed the fix-oidc-valid-urls branch from 64a9c73 to 38e6249 Compare December 24, 2021 07:56
@yolossn yolossn changed the title backend: Update oidc-valid-redirect-urls help string backend: Autogenerate default oidc-valid-redirect-urls Jan 3, 2022
Copy link
Collaborator

@joaquimrocha joaquimrocha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a small comment which I think will improve the code.

@@ -62,15 +62,15 @@ var (
oidcClientID = flag.String("oidc-client-id", "", "OIDC client ID used for authentication")
oidcClientSecret = flag.String("oidc-client-secret", "", fmt.Sprintf("OIDC client Secret used for authentication; can be taken from %s env var too", oidcClientIDEnvName))
oidcIssuerURL = flag.String("oidc-issuer-url", "", fmt.Sprintf("OIDC issuer URL used for authentication;can be taken from %s env var too", oidcClientSecretEnvName))
oidcValidRedirectURLs = flag.String("oidc-valid-redirect-urls", "http://localhost:8000/*", "OIDC valid Redirect URLs accepts comma separated values with wildcard *, for example if nebraska is hosted at http://nebraska.kinvolk.io the value should be http://nebraska.kinvolk.io/*")
oidcValidRedirectURLs = flag.String("oidc-valid-redirect-urls", fmt.Sprintf("%s/*", *nebraskaURL), "OIDC valid Redirect URLs; accepts comma separated values and supports wildcards (*), for example http://nebraska.example.io/*. If not set defaults to <nebraska-url>/*")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's easier if you set the oidcValidRedirectURLs as "" because this way you know already that it's not been set.
The docs make it explicit what it does if the user doesn't override it.

@@ -165,6 +165,16 @@ func mainWithError() error {

url.Path = "/login/cb"

if (*nebraskaURL != "http://localhost:8000") && (*oidcValidRedirectURLs == "http://localhost:8000/*") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the oidcValidRedirectURLs as an empty string by default, this check becomes much simpler: if *oidcValidRedirectURLs == ""

This patch auto generates the default OIDC valid redirect
URLs from the nebraska-url arg if the oidc-valid-redirect-urls
is not provided``.

Signed-off-by: Santhosh Nagaraj S <[email protected]>
@yolossn yolossn force-pushed the fix-oidc-valid-urls branch from 38e6249 to b2d08f5 Compare January 10, 2022 08:19
@yolossn yolossn requested a review from joaquimrocha January 10, 2022 08:19
@joaquimrocha joaquimrocha merged commit cd296e5 into main Jan 11, 2022
@joaquimrocha joaquimrocha deleted the fix-oidc-valid-urls branch January 11, 2022 16:33
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.

oidc auth login redirect bug breaks auth flow
2 participants