Code Monkey home page Code Monkey logo

Comments (13)

pierrre avatar pierrre commented on June 14, 2024

+1

from fosoauthserverbundle.

willdurand avatar willdurand commented on June 14, 2024

You're right, this method has a wrong behavior. Would you mind write a pull request to fix it?

For the OAuth2 lib, the bug is really tricky. Actually, there won't be any problem to use the real public id, and to fix the method you pointed. It will work, and the test $client->getPublicId() != $authCode->getClientId() will return true.

There is an issue I'm trying to fix on this bundle: the random id. It should not follow the pattern: {client_id}_{random_id}. The bug I'm describing shows us why it's bad.

  • getPublicId() will return something like: 4_AEZFEDZD...
  • getClientId() will return 4

Or, without a strict equality, we have an integer equals to a integer converted from a string. As the client id is always the first character of the public id, and the second one is an underscore, by chance we have a true equality.

Then, two ways to fix this issue:

  • first, to patch the lib;
  • second, to change the public id pattern, it will be BC break, but necessary.

from fosoauthserverbundle.

willdurand avatar willdurand commented on June 14, 2024

Actually, the lib just describe a getter for a client id in the IClientInterface, so the method is right.

That means forget my previous comment. There is a patch to fix the strict equality in the lib to do, but nothing else. Btw, Propel doesn't fit the spec... There is a bug in the Propel implementation.

from fosoauthserverbundle.

mdestagnol avatar mdestagnol commented on June 14, 2024

I'm sorry willdurand but I do not follow you. In the Oauth2-php lib, the 2 lines are contradictory:

Line 814 : $client->getId() != $token->getClientId()
Line 748 : $client->getPublicId() != $authCode->getClientId()

Why would you have both a getId and a getPublicId, when the IOAuth2Client and OAuth2Client mention only a getPublicId?

from fosoauthserverbundle.

mdestagnol avatar mdestagnol commented on June 14, 2024

Oups sorry, just understood that in fact we agree. :)

So we just need a patch to change the line 814, I'm I right?

from fosoauthserverbundle.

willdurand avatar willdurand commented on June 14, 2024

Yep. And a deep inspection of the lib. We also have to put === on lines you mentioned.

from fosoauthserverbundle.

mdestagnol avatar mdestagnol commented on June 14, 2024

Done. Here is the pull request : FriendsOfSymfony/oauth2-php#6

from fosoauthserverbundle.

willdurand avatar willdurand commented on June 14, 2024

I'm closing this issue as it's fixed now.

from fosoauthserverbundle.

vbardales avatar vbardales commented on June 14, 2024

It isn't fix in Propel, is it ?

from fosoauthserverbundle.

willdurand avatar willdurand commented on June 14, 2024

@vbardales there is no issue with the model layer.

from fosoauthserverbundle.

vbardales avatar vbardales commented on June 14, 2024

Ok, getClientId is not overriden in FOSOAuthServerBundle / Propel / AuthCode.php in 1.1.x branch.

from fosoauthserverbundle.

willdurand avatar willdurand commented on June 14, 2024

@vbardales ah, you are probably using the 1.1.x branch, so you should upgrade or backport commits from the master branch. I don't really know how to upgrade the 1.1.x from master.
It should be possible because the BC break is just due to the AuthorizeFormType (getDefaultOptions() signature to be more precise). If you want to try to backport features from master into 1.1x, I will be glad. Your best option is to cherry-pick commits I think.

from fosoauthserverbundle.

willdurand avatar willdurand commented on June 14, 2024

@vbardales yep

from fosoauthserverbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.