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

Use the same issuer in token and discovery responses #24

Merged
merged 7 commits into from
Dec 12, 2024

Conversation

alecpl
Copy link
Contributor

@alecpl alecpl commented Aug 28, 2024

OIDC clients compare discovered issuer with token's issuer. So, these must be the same.

Mentioned in #23.

@alecpl
Copy link
Contributor Author

alecpl commented Aug 28, 2024

I see that there are no tests for Laravel stuff including DiscoveryController. It means that some tests fail because can't use url() without Laravel. I'm not sure what to do with that.

@alecpl
Copy link
Contributor Author

alecpl commented Aug 28, 2024

I added forcing of https:// in Discovery. So, it fixes #23. The issuer is simplified/unified to 'https://' . $_SERVER['HTTP_HOST'] in both places.

return $this->config
->builder()
->permittedFor($accessToken->getClient()->getIdentifier())
->issuedBy($issuer)
->issuedBy('https://' . $_SERVER['HTTP_HOST'])
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think we should force the https here, we could use the default value from laravel and fallback on https only if missing.
Locally, we may want to work on unsecured connection.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be fair it was 'https://' . $_SERVER['HTTP_HOST'] before #13

@jeremy379 jeremy379 merged commit 145fe4d into jeremy379:main Dec 12, 2024
3 checks passed
$response = [
'issuer' => url('/'),
'issuer' => 'https://' . $_SERVER['HTTP_HOST'],
Copy link
Contributor

Choose a reason for hiding this comment

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

@jeremy379 This broke my unit test which was calling it without a HTTP_HOST. Maybe a good idea to fallback on both to route('/'), so also for the Id & Access tokens?

Copy link
Contributor

@bbredewold bbredewold Dec 17, 2024

Choose a reason for hiding this comment

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

@christiaangoossens @jeremy379 Same here. Since this is a Laravel package, I think we need to stop using $_SERVER variables, and use the Request object to obtain the needed urls.

Made an issue #32

Copy link
Owner

Choose a reason for hiding this comment

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

Hello
I'm sorry for these issue

Request isn't directly available here, so I choose to provide option on how this should be filled.

Here is a fix MR: #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.

5 participants