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

don't call post action for oauth routes #343

Merged
merged 2 commits into from
Mar 29, 2017
Merged

Conversation

mikz
Copy link
Contributor

@mikz mikz commented Mar 29, 2017

  • post_action should be called only after access phase
  • oauth has own router so it does not need post_action

fixes #299 (comment)

because there is just one instance of apicast module
it can be used as global state
but still thrown out when new instance is created in tests
for example oauth has own routes that can handle the request
so there is no need to call post_action for them

it should be called only when the access phase is evaluated
Copy link
Contributor

@mpguerra mpguerra left a comment

Choose a reason for hiding this comment

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

I can't comment too much on the validity of the code, but I can see that we're no longer calling the proxy when requesting tokens both from RH SSO and APIcast OAuth

@mikz mikz merged commit a38afcb into master Mar 29, 2017
@mikz mikz deleted the proxy-post_action-oauth branch March 29, 2017 09:51
@mikz mikz removed the in progress label Mar 29, 2017
local p = ngx.ctx.proxy or post_action_proxy[request_id]

post_action_proxy[request_id] = nil

if p then
p:post_action()
return p:post_action()
else
ngx.log(ngx.INFO, 'could not find proxy for request id: ', request_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

This info message looks a bit alarming, like if it was supposed to find proxy, but couldn't, while most of the times it is absolutely fine and deliberate. Maybe say "skipping post_action, as no proxy was registered for the request id", and move it to DEBUG level?...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was thinking about that. INFO is first opt-in level so it is not shown by default.

I guess this should be part of some major log refactoring as there is lots of duplicated / too verbose information already.

Copy link
Contributor

@mayorova mayorova left a comment

Choose a reason for hiding this comment

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

Looks good

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.

Ensure correctness of APIcast
4 participants