Commit Graph

12 Commits

Author SHA1 Message Date
Zaiming Shi 6354e75626 chore: update copyrights 2021-04-23 20:43:00 +02:00
zhouzb 7ea75f4289 Update copyright 2020-01-03 18:31:08 +08:00
zhanghongtong 496bd7ed56 Add more test cases 2019-12-13 18:15:38 +08:00
zhouzb e3ddd4ebe9 Make test cases pass temporarily 2019-11-01 16:58:53 +08:00
Feng Lee 7be110cdef Add more test cases 2019-10-23 16:35:15 +08:00
Feng Lee 4afa02ee48 Update all the test cases 2019-08-06 09:04:37 +08:00
Feng Lee c8317a230d Update copyright 2019-08-03 11:43:30 +08:00
Shawn 02fe8560e2
Improve emqx_hooks and credentials (#2309)
* Improve emqx_hooks and credentials

1. Modify the return modes of emqx hooks.

Change the return value of hook functions to:
- ok: stop the hook chain and return ok
- {error, Reason}: stop the hook chain and return error
- continue: continue the hook chain

And the return value of emqx_hooks:run/2 is changed to:
- ok
- {error, Reason}

And the return value of emqx_hooks:run/3:
- {ok, Acc}
- {error, Reason, Acc}

2. Treat password as a member of credentials.

Password should be wrapped in the `credentials` data-structure, as the
username/password pair together consists of an authentication method.
There can be some methods using some other credential data (e.g.
a JWT token), and these credential data should also be wrapped in the
the `credentials` data-structure.

An event `client.authenticate` is triggered when an user logs in:
```erlang
emqx_hooks:run('client.authenticate', [], Credentials)
```

A `default callback` that deny/allow any user (according to the
`allow_anonymous` config) should be appended to the end of the
callback chain.

The `credentails` is passed through all of the callbacks, and
can be changed over in this process.

* Refactor emqx hooks return mode

* Remove password from PState
2019-03-16 10:43:53 +08:00
Shawn 111b66121c
Support TLS/DTLS PSK (#2297)
* Improve filter functions for emqx-hook

* Add PSK hook

* Reset hook args for filter functions
2019-03-13 22:24:19 +08:00
turtled 31e95b56c4 Update Copyright to 2019 2019-01-29 10:43:25 +08:00
tigercl 873a08dc94
Improve coverage for emqx_hooks, and add test case for emqx_mod_sup (#1892)
Improve coverage for emqx_hooks, and add test case for emqx_mod_sup
2018-10-19 16:21:43 +08:00
Feng Lee 2a75105580 Improve the Hooks's design 2018-09-06 16:27:16 +08:00