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

[6.x] RedisBroadcaster - Ignore Redis Prefix When Verifying Channel Access #30597

Merged
merged 2 commits into from Nov 15, 2019

Conversation

@tlaverdure
Copy link
Contributor

tlaverdure commented Nov 14, 2019

Since 5.8 Laravel ships with Redis configured with a prefix to prevent conflicts when apps share a Redis store. This prefix is also used in the RedisBroadcaster to broadcast events and verify channels.

While using Laravel Echo Server some developers want to match the prefixing in their configurations with that in their Laravel app. This can work by add the keyPrefix to the server config, however, when authorizing private channels the prefix conflicts with the private channel definition in Laravel. For example:

Broadcast::channel('App.User.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

With prefixing the channel is read as laravel_database_private-App.User.1 in RedisBroadcaster::auth instead of private-App.User.1.

@tlaverdure tlaverdure changed the title [6.x] Ignore Redis Prefix When Verifying Access [6.x] RedisBroadcaster - Ignore Redis Prefix When Verifying Channel Access Nov 14, 2019
@driesvints

This comment has been minimized.

Copy link
Member

driesvints commented Nov 15, 2019

This is for #28701 I believe. Thank you for checking in on this 👍

Are there any breaking changes we should be aware of?

@tlaverdure

This comment has been minimized.

Copy link
Contributor Author

tlaverdure commented Nov 15, 2019

You're welcome! No breaking changes that I can think of.

@taylorotwell taylorotwell merged commit b204042 into laravel:6.x Nov 15, 2019
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@taylorotwell

This comment has been minimized.

Copy link
Member

taylorotwell commented Nov 15, 2019

Thanks. I had to tweak this a bit since we don't use the global config helper outside of service providers and factories, so I just injected the prefix into the broadcaster.

@tlaverdure tlaverdure deleted the tlaverdure:redis-broadcaster-remove-prefix branch Nov 15, 2019
@driesvints

This comment has been minimized.

Copy link
Member

driesvints commented Nov 21, 2019

Unfortunately this didn't fix #28701 apparently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.