Skip to content

Since we force opts.prompt = "none" below the option is retained. #119

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

Closed
wants to merge 2 commits into from

Conversation

gdestuynder
Copy link
Contributor

This means if the code is re-called without re-loading opts the call
to authenticate will be done with opts.prompt = "none" again, where
user interaction would be expected.
This happens if opts is declared as a global value in openresty/nginx,
such as by:
init_by_lua_file "/usr/local/openresty/nginx/conf/conf.d/server.lua";
in nginx.conf, where server.lua contains the opts structure.
This happens when the server owner needs a global opts declaration
reachable by all server {} structures in nginx.

This means if the code is re-called without re-loading `opts` the call
to authenticate will be done with `opts.prompt = "none"` again, where
user interaction would be expected.
This happens if `opts` is declared as a global value in openresty/nginx,
such as by:
`init_by_lua_file "/usr/local/openresty/nginx/conf/conf.d/server.lua";`
in `nginx.conf`, where `server.lua` contains the `opts` structure.
This happens when the server owner needs a global `opts` declaration
reachable by all `server {}` structures in nginx.
do not, and doing so prevent normal functionality.
In fact, before the test, there was a condition where the parameter was
already forced to `none` and the current test wasn't covering this
issue.
@gdestuynder
Copy link
Contributor Author

Note: I had to drop the test checking that the prompt parameter set in opts is honoured - because we did not in fact honour it in some conditions (the test would not see that), and with this fix, we never honour it.
If we do, it would break functionality - and since opts is not only used as a user parameter but also as a structure to pass data internally, I didn't find another solution that wouldn't require either refactoring a lot of code, or having a function that behaves differently than other functions :(

@zandbelt
Copy link
Contributor

I guess a better approach would be to explicitly pass a prompt parameter into authenticate and openidc_authorize though that changes the function signature and backwards compatibility...?

@bodewig
Copy link
Collaborator

bodewig commented Nov 11, 2017

with this PR we'd break code that explicitly asks for the prompt parameter when calling authenticate (which is what the test checks ;-). I'd prefer an explicit parameter over silently discarding the options set.

One option not breaking backwards compatibility could be to only add the explicit parameter to openidc_authorize, set it with opts.prompt in most cases and set it to none in the "silently reauthenticate" case without changing opts there at all. That way opts wouldn't get modified by authenticate. Would this work for you @gdestuynder ?

@bodewig
Copy link
Collaborator

bodewig commented Nov 11, 2017

@gdestuynder bodewig@195c955 is an alternative solution

@zandbelt
Copy link
Contributor

I'd prefer Stefan's approach if acceptable @gdestuynder

@gdestuynder
Copy link
Contributor Author

gdestuynder commented Nov 13, 2017

@bodewig that sounds alright

@bodewig
Copy link
Collaborator

bodewig commented Nov 14, 2017

thanks, see #120

@zandbelt zandbelt closed this Nov 14, 2017
@gdestuynder
Copy link
Contributor Author

hah great thank you!

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.

3 participants