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

Handle client_id/client_secret nil case. #85

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

ragaskar
Copy link
Contributor

@ragaskar ragaskar commented Jan 28, 2022

The commit (e351f4d) that introduced UAA url escape encoding compatibility means client_id and client_secret can no longer be nil or an error is thrown.

I am honestly not 100% sure if the nil case should be valid (we have a series of -- I think -- integration tests that are using nil here, so perhaps it is?). In any case, the nil case was previously supported. If the nil case is invalid, maybe this class should throw ArgumentError on instantiation instead?

I made this change targeted within the #request_token method because I'm not sure what the possible implications would be by defaulting it in the initialize, but that might arguably be a better place for it if it does not cause a behavior change.

One other minor note: when reading the code I found the option name basic_auth a little confusing, since both requests are using basic_auth. After reading about the reason for the switch, I wonder if something like "unescaped_basic_auth" (or something similar) might be a better name? If you agree, happy to also create a PR that provides both the old 'basic_auth' (for backwards compatibility) and new option.

- `CGI.escape` throws errors on nil.
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/181076709

The labels on this github issue will be updated when the story is started.

@strehle
Copy link
Member

strehle commented Jan 28, 2022

ok thanks. Do you need a new release urgently ?

@strehle strehle merged commit adc5806 into master Jan 28, 2022
@strehle strehle deleted the handle-nil-client-id-and-secret branch January 28, 2022 17:37
@strehle
Copy link
Member

strehle commented Jan 28, 2022

One other minor note: when reading the code I found the option name basic_auth a little confusing, since both requests are using basic_auth. After reading about the reason for the switch, I wonder if something like "unescaped_basic_auth" (or something similar) might be a better name? If you agree, happy to also create a PR that provides both the old 'basic_auth' (for backwards compatibility) and new option.

sure you can also create a new PR with new options
The meaning should be clear, UAA is an Oauth2 server and it does OAuth2 Based Header Encoding of Authorization and not plain Baisc encoding.
If you have no special characters, then this does not matter but if you have special characters, then it matters.
Details in : cloudfoundry/cf-uaac#50 (comment)

The change itself was in uaac a while ago, but it should have been here before .
Issue cloudfoundry/cf-uaac#50

@strehle
Copy link
Member

strehle commented Jan 28, 2022

I am honestly not 100% sure if the nil case should be valid (we have a series of -- I think -- integration tests that are using nil here, so perhaps it is?). In any case, the nil case was previously supported. If the nil case is invalid, maybe this class should throw ArgumentError on instantiation instead?

It is ok from coding to have this, but for UAA there cannot be a nil in client_id or client_secret
In cf oauth client you have an empty secret, e.g. cf and "" -> Y2Y6 , but this is not nil (null). UAA needs always the parameter client_id and client_secret, event if it is empty, it is not null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants