Git Product home page Git Product logo

emq-auth-jwt's People

Contributors

dopry avatar emqplus avatar hjianbo avatar huangdan avatar

Watchers

 avatar  avatar

Forkers

drumanew

emq-auth-jwt's Issues

Implement ACL support for JWTs

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.

  1. Given a request to publish a message to a topic and there a no matching scopes then the request should be rejected.
message = "hello"
topic = "/user/23445/status"
scopes = [ ]
  1. Given a request to publish 'hello' to a topic and there is a matching scope then the request should be accepted.
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:/#"
]
  1. Given a request to subscribe to a topic and there a no matching scopes then the request should be rejected.
topic = "/user/23445/status"
scopes = [ ]
  1. Given a request to subscribe to a topic and there is a matching scope then the request should be accepted.
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:/#"
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.