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

g object is not accessible in x-bearerInfoFunc #1881

Closed
gaurav-triverus opened this issue Feb 14, 2024 · 1 comment · Fixed by #1883
Closed

g object is not accessible in x-bearerInfoFunc #1881

gaurav-triverus opened this issue Feb 14, 2024 · 1 comment · Fixed by #1883

Comments

@gaurav-triverus
Copy link

Description

with connexio3.0 upgrade, x-bearerInfoFunc is executing before before_request. in this case flask g object is not accessible in x-bearerInfoFunc.

Expected behaviour

currently we are at connexion 2.14 version and upgrading it to the latest version.
in x-bearerInfoFunc after validating the token, we are validating the user in database too.
we are creating a db session in before_request and then commiting and close the session in after_request. in previous version before_request is being executed before x-bearerInfoFunc. so the flask g object and db session is available in x-bearerInfoFunc.

Actual behaviour

Steps to reproduce

Additional info:

Output of the commands:

  • python --version
    Python 3.9.18
  • pip show connexion | grep "^Version\:"
    Version: 3.0.5
@RobbeSneyders
Copy link
Member

Duplicate of #1880. Please check my answer there.

RobbeSneyders added a commit that referenced this issue Mar 20, 2024
Fixes #1881
Fixes #1880
Fixes #1876

Alternative to #1750

This PR makes the current request available to the security handlers by
injecting it as a keyword. I think this is a proper alternative to
#1750, since this is the only place in the default middleware stack
where I expect this to be needed.
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 a pull request may close this issue.

2 participants