doorkeeper
doorkeeper copied to clipboard
pass application into AccessToken#create method
This avoids refetching the application object from the database when it's referenced inside of attributes_for_token_generator
. Closes #1574
I thought it should be cached if already called :thinking: Also I;m wondering if we could break any existing ORM extension with such changes. Have to think
I thought it should be cached if already called 🤔 Also I;m wondering if we could break any existing ORM extension with such changes. Have to think
In my case the application passed into the method was initially fetched by name, but within theAccessToken
model it fetches by ID so it missed the query cache.
It's likely this hasn't come up before because for the built-in implementation where tokens are being generated via Doorkeeper::ApplicationsController
the application is fetched by the application_id
provided in the params. Not sure of other use cases where the application object may not be fetched by ID and if those warrant this change.
OK, analyzed some source code and I think it should be fine. Thanks!
Aha, tests shows some issues
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.