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

Add support of PKCE #1045

Merged
merged 7 commits into from
Jun 12, 2023
Merged

Add support of PKCE #1045

merged 7 commits into from
Jun 12, 2023

Conversation

thaarok
Copy link
Contributor

@thaarok thaarok commented Feb 26, 2023

This is built on #951, but missing parts was added:

Any feedback is welcome!

Copy link
Owner

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

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

This is a great PR! Thank you for adding PKCE support! Just some minor formatting changes and we can merge this.

I'll also add tests in another PR unless you'd like to add those as well

src/OAuth2/GrantType/AuthorizationCode.php Outdated Show resolved Hide resolved
src/OAuth2/GrantType/AuthorizationCode.php Outdated Show resolved Hide resolved
src/OAuth2/GrantType/AuthorizationCode.php Show resolved Hide resolved
@thaarok
Copy link
Contributor Author

thaarok commented May 20, 2023

@bshaffer Updated, thank you! :)

@bshaffer bshaffer merged commit 894f672 into bshaffer:main Jun 12, 2023
@jasverix
Copy link

Should probably mark this upgrade somehow, because it breaks the system if the developers does not apply a migration. I don't have a good suggestion on how you could have marked it, but when I first looked at the upgrade log, I did not detect that it was a breaking upgrade.

I will of course just do the migration and continue to use this package, but I just wanted to give this feedback. It is a very well working and good package.

@bshaffer
Copy link
Owner

I did not realize this was a breaking change. I will revert it. Can you post the migration you used to fix the issue?

@bshaffer
Copy link
Owner

This also SHOULDNT be a breaking change, it should be opt-in. Can you post the error you received as well?

@jasverix
Copy link

jasverix commented Jun 14, 2023

I can replicate the exact error message if you want. But it was something like 'column code_challenge does not exist' in the INSERT INTO query. See my comments from the code as well.

@bshaffer
Copy link
Owner

Great. I figured it was something like that. That shouldn’t be too hard to fix then.

@Wirone
Copy link

Wirone commented Jun 22, 2023

This is a breaking change because of change in AuthorizationCodeInterface::setAuthorizationCode() signature. Any class implementing this causes fatal error now. In our case Renovate Bot tried to upgrade this package, but fortunately our tests failed, so it wasn't merged.

image

@bshaffer what's the plan for it? Consider using PHP SemVer Checker 🙂.

@Wirone
Copy link

Wirone commented Jul 6, 2023

@bshaffer what's the situation? We have internal MR with changes aligning our code with this change, but we don't know if we should merge it because if revert is done, we also would need to revert on our side 🙈. Please let us know.

@bshaffer
Copy link
Owner

bshaffer commented Jul 6, 2023

I am sorry, I am not really maintaining this library more than merging PRs. If you have a fix you'd like to submit I'm happy to review it.

@Wirone
Copy link

Wirone commented Jul 7, 2023

@bshaffer I was just referring to what you said:

I will revert it

But it never happened 😉. Since it's a change in the interface, there's no way to refactor it in non-breaking way (moving those 2 added arguments to separate method would be breaking as well). I believe it's a change worth keeping, so what should be done IMHO:

  • revert this change and tag 1.14.1: people who did not upgrade yet would have clean upgrade path, without breaking change
  • bring back this change and tag 2.0.0: people who already upgraded to 1.14.0 would have another BC break, but they should only bump to 2.0 and continue with their current code (that's why there shouldn't be other BC-breaks in 2.0, to be compatible with what people already did).

We just need clear information what's the plan about this, if it's going to be kept as-is, we'll just merge changes on our side and continue with this BC-break. If you're going to revert it, we won't change implementation on our side 🙂.

@bshaffer
Copy link
Owner

bshaffer commented Jul 7, 2023

IMHO adding two empty methods to whatever custom classes extend the interface in a dependent library is not too much to ask. I understand that this breaks semver, but at this point the damage is done, and someone can simply pin to the previous version if they don't want the breaking change.

@rdamas
Copy link

rdamas commented Aug 2, 2023

The documentation here: https://bshaffer.github.io/oauth2-server-php-docs/cookbook/ should probably be updated to reflect the database change, the columns code_challenge and code_challenge_method are not mentioned yet.

@aarangara
Copy link

aarangara commented Aug 31, 2023

Is this (PKCE) only supposed to work with OpenID - because currently it does not seem to work for me when use_openid_connect = false.

Or any reason PCKE authorization cannot be used without use_openid_connect?

For e.g. The Oauth2\Controller\AuthorizeController does not have any code that set-ups the code_challenge and code_challenge_variable. The only change this MR had to that file is 'enforce_pkce' => false

But if you check Oauth2\OpenID\Controller\AuthorizeController, it has got some code in validateRequest does some checks for PKCE.

@campbsb
Copy link

campbsb commented Oct 2, 2023

The documentation here: https://bshaffer.github.io/oauth2-server-php-docs/cookbook/ should probably be updated to reflect the database change, the columns code_challenge and code_challenge_method are not mentioned yet.

+1

I've had to add best-guess definitions for these undocumented code_challenge and code_challenge_method fields.

@bshaffer
Copy link
Owner

bshaffer commented Oct 2, 2023

Thanks for the nudge, I will update it

@bshaffer
Copy link
Owner

bshaffer commented Oct 2, 2023

@ArnoHolo
Copy link

ArnoHolo commented Oct 4, 2023

I suggest you indicate it as a Breaking Change in the Release of the 1.14.0 version => https://github.com/bshaffer/oauth2-server-php/releases/tag/v1.14.0

@bshaffer
Copy link
Owner

bshaffer commented Oct 4, 2023

@ArnoHolo done

@thaarok thaarok deleted the pkce branch June 12, 2024 15:34
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.

9 participants