-
Notifications
You must be signed in to change notification settings - Fork 17
[ECO-4845] Fix wildcard clientId #418
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
[ECO-4845] Fix wildcard clientId #418
Conversation
1. Renamed rest auth extra_auth_headers to client_id_header with both rest/realtime specific impl 2. Added method client_id_header_sync to realtime auth 3. Annotated implementation with right spec
lib/ably/auth.rb
Outdated
| def client_id_header(realtime=false) | ||
| if options[:client_id] && using_basic_auth? | ||
| if realtime | ||
| { 'clientId' => options[:client_id] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For realtime connections the clientId is passed in the query params, not as a header - see RSA7e1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think by putting the realtime setting in a method that explicitly mentions header (even if its later put in the right place by subsequent code) is going to make things confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's just a naming convention. I will try to make it more meaningful 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as spec impl. is concerned, setting clientId for both realtime and rest follows exactly similar checks
spec- RSA7e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated -> bb4b71f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe custom_client_id or external_client_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated -> 0f49ede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, perhaps we should just have a method which returns the client id to use in the request:
def client_id_for_request
if options[:client_id] && using_basic_auth?
return options[:client_id]
else
return nil
end
endand we update the existing extra_auth_headers method to call this, and update create_websocket_transport to call it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 1ff7d6b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, looks good to me — will leave to @AndyTWF to resolve if happy since it's his thread
|
@sacOO7 is this a bug that only affects the v2 branch? If not, then shouldn't the fix go into |
|
@lawrence-forooghian there is no rush, this problem have been for a long time. Workaround on realtime side implemented for all version <= 1.2.5 |
Actually, this bug was caused by server side changes, so they have patched a fix that will work for ably-ruby <= 1.2.5 |
lib/ably/auth.rb
Outdated
| def client_id_header(realtime=false) | ||
| if options[:client_id] && using_basic_auth? | ||
| if realtime | ||
| { 'clientId' => options[:client_id] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, perhaps we should just have a method which returns the client id to use in the request:
def client_id_for_request
if options[:client_id] && using_basic_auth?
return options[:client_id]
else
return nil
end
endand we update the existing extra_auth_headers method to call this, and update create_websocket_transport to call it?
…ce local members" This reverts commit c10e485.
ttypic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
Thanks for the review |
Fixed #414