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

Introduce headersProvider and paramsProvider to auth options #639

Merged
merged 5 commits into from Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog

## 7.6.0

- [ADDED] Introduce and to channel authorization and user authentication in order to allow for changing header and param values after the Pusher object is initialized.

## 7.5.0

- [ADDED] Watchlist Online Status
Expand Down
14 changes: 11 additions & 3 deletions README.md
Expand Up @@ -144,10 +144,10 @@ var presenceChannel: PusherTypes.PresenceChannel;

### React Native

> **⚠️ Important notice**
> **⚠️ Important notice**
>
> React Native support has been **deprecated** and soon will be removed from this repository.
>
> React Native support has been **deprecated** and soon will be removed from this repository.
>
> Please, use our official [React Native SDK](https://github.com/pusher/pusher-websocket-react-native) instead.

### Web Workers
Expand Down Expand Up @@ -232,6 +232,10 @@ Object containing the configuration for user authentication. Valid keys are:

* `headers` (Object) - Only applied when using `ajax` as authentication transport. Provides the ability to pass additional HTTP Headers to the user authentication endpoint. This can be useful with some web application frameworks that guard against CSRF CSRF (Cross-site request forgery).

* `paramsProvider` (Function) - When present, this function is called to get additional parameters to be sent when the user authentication endpoint is called. This is equivalent to passing them on the params key, but allows for the parameters to be retrieved dynamically at the time of the request.

* `headersProvider` (Function) - When present, this function is called to get additional headers to be sent when the user authentication endpoint is called. This is equivalent to passing them on the headers key, but allows for the headers to be retrieved dynamically at the time of the request.

* `customHandler` (Function) - When present, this function is called instead of a request being made to the endpoint specified by `userAuthentication.endpoint`.


Expand All @@ -252,6 +256,10 @@ Object containing the configuration for user authorization. Valid keys are:

* `headers` (Object) - Only applied when using `ajax` as authorizing transport. Provides the ability to pass additional HTTP Headers to the user authorization endpoint. This can be useful with some web application frameworks that guard against CSRF CSRF (Cross-site request forgery).

* `paramsProvider` (Function) - When present, this function is called to get additional parameters to be sent when the user authentication endpoint is called. This is equivalent to passing them on the params key, but allows for the parameters to be retrieved dynamically at the time of the request.

* `headersProvider` (Function) - When present, this function is called to get additional headers to be sent when the user authentication endpoint is called. This is equivalent to passing them on the headers key, but allows for the headers to be retrieved dynamically at the time of the request.

* `customHandler` (Function) - When present, this function is called instead of a request being made to the endpoint specified by `channelAuthorization.endpoint`.


Expand Down
42 changes: 34 additions & 8 deletions dist/node/pusher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/node/pusher.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/react-native/pusher.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-native/pusher.js.map

Large diffs are not rendered by default.

45 changes: 36 additions & 9 deletions dist/web/pusher-with-encryption.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/web/pusher-with-encryption.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pusher-with-encryption.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/web/pusher-with-encryption.min.js.map

Large diffs are not rendered by default.

45 changes: 36 additions & 9 deletions dist/web/pusher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/web/pusher.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pusher.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/web/pusher.min.js.map

Large diffs are not rendered by default.

42 changes: 34 additions & 8 deletions dist/worker/pusher-with-encryption.worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/worker/pusher-with-encryption.worker.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/worker/pusher-with-encryption.worker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/worker/pusher-with-encryption.worker.min.js.map

Large diffs are not rendered by default.