Commit Graph

10 Commits

Author SHA1 Message Date
Zaiming Shi 6354e75626 chore: update copyrights 2021-04-23 20:43:00 +02:00
张奇怪 78144c0ca5
Update error log (#3342)
Optimize content of error log
2020-03-27 10:10:23 +08:00
zhouzb 7ea75f4289 Update copyright 2020-01-03 18:31:08 +08:00
Feng Lee 3877c4db1a Merge branch 'channel2' into channel3 2019-06-18 16:49:26 +08:00
terry-xiaoyu 7092748266 Improve log messages using logger header 2019-06-18 14:37:32 +08:00
Feng Lee 21162f88b8 Update copyright 2019-06-18 14:27:06 +08:00
terry-xiaoyu 3f1b788fe8 Remove unused PSK TAB macro 2019-06-14 16:58:46 +08:00
周子博 58e1b4d485 Readjust log level and unify log format 2019-03-26 22:18:31 +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