getautomata / emq-auth-jwt Goto Github PK
View Code? Open in Web Editor NEWThis project forked from emqx/emqx-auth-jwt
EMQ JWT Authentication Plugin
License: Apache License 2.0
This project forked from emqx/emqx-auth-jwt
EMQ JWT Authentication Plugin
License: Apache License 2.0
Our authorization service will add a scopes collection to the JWT.
{
iat: 1416929109,
jti: aa7f8d0a95c,
scopes: [
"emq:subscribe:/user/+/status",
"emq:publish:/user/23445/#"
]
}
A scope entry will be in the form of: {{service}}:{{action}}:{{mqtt topic}}
{{service}} will be a constant, emq
{{action}} will be on of 'publish' or 'subscribe'
{{mqtt topic}} will be and MQTT topic, wildcards are allowed, see: http://www.steves-internet-guide.com/understanding-mqtt-topics/ for more detail on MQTT topics.
When a user tries to publish or subscribe to a topic the scopes property of the JWT should be inspected and if the topic matches the actions should be allowed. Otherwise, the action should be rejected.
message = "hello"
topic = "/user/23445/status"
scopes = [ ]
message = "hello"
topic = "/user/23445/status"
# matching scopes could be any of the following
scopes = [
"emq:publish:/user/23445/status",
"emq:publish:/user/23445/+",
"emq:publish:/user/+/+",
"emq:publish:/+/+/+",
"emq:publish:/user/23445/#",
"emq:publish:/user/#"
"emq:publish:/#"
]
topic = "/user/23445/status"
scopes = [ ]
topic = "/user/23445/status"
# matching scopes could be any of the following
scopes = [
"emq:subscribe:/user/23445/status",
"emq:subscribe:/user/23445/+",
"emq:subscribe:/user/+/+",
"emq:subscribe:/+/+/+",
"emq:subscribe:/user/23445/#",
"emq:subscribe:/user/#"
"emq:subscribe:/#"
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.