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

Allow non-root OIDC issuer #5

Merged
merged 1 commit into from
Mar 15, 2023
Merged

Conversation

kschibli
Copy link
Contributor

@kschibli kschibli commented Mar 6, 2023

My OIDC endpoint is not at the root and I couldn't use discover_jwks via from_oidc because it would strip the path of the issuer.

Before:

issuer: 'https://example.com/myissuer/'
result: 'https://example.com/.well-known/openid-configuration'

After:

issuer: 'https://example.com/myissuer/'
result: 'https://example.com/myissuer/.well-known/openid-configuration'

I checked, and having the discovery url not at the root seems to be supported by the standard:

https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationRequest

My OIDC endpoint is not at the root and I couldn't use `discover_jwks`
because it would strip the path of the issuer.

Before:
```
issuer: 'https://example.com/myissuer/'
result: 'https://example.com/.well-known/openid-configuration'
```

After:
```
issuer: 'https://example.com/myissuer/'
result: 'https://example.com/myissuer/.well-known/openid-configuration'
```

I checked, and having the discovery url not at the root seems to be
supported by the standard:

https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfigurationRequest
@cduvray
Copy link
Owner

cduvray commented Mar 8, 2023

Yeah you are absolutely right this is a bug, but I think, to make this work properly we should replace "join".

This assert is passing:

assert_eq!(
        Url::parse("https://example.net/a/b")?
            .join(".well-known/openid-configuration")?
            .to_string(),
        "https://example.net/a/.well-known/openid-configuration"
    );

as you see 'b' disappears from the url.

I think this should be something like:

url
        .path_segments_mut()?
        .pop_if_empty()
        .extend(&[".well-known", "openid-configuration"]);

@cduvray
Copy link
Owner

cduvray commented Mar 15, 2023

Ok, I will merge this and I will remove join after that.

@cduvray cduvray merged commit 2bb4b4c into cduvray:main Mar 15, 2023
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.

2 participants