deepch/RTSPtoWeb

Protecting streams with authentication

jktz903 opened this issue · 1 comments

How do I protect my streams with basic authentication? config.json seems to offer some options but I'm unable to find any documentation on this matter. Any ideas would be appreciated.

You have to place your own api inside the token which will authenticate the resource. Here is a simple config having auth.

{
  "channel_defaults": {
    "on_demand": true
  },
  "server": {
    "debug": true,
    "http_debug": false,
    "http_demo": true,
    "http_dir": "",
    "http_login": "demo",
    "http_password": "demo",
    "http_port": ":8083",
    "https": false,
    "https_auto_tls": false,
    "https_auto_tls_name": "",
    "https_cert": "",
    "https_key": "",
    "https_port": "",
    "ice_credential": "",
    "ice_servers": [
      "stun:stun.l.google.com:19302"
    ],
    "token": {
    "enable": true,
    "backend": "your_api_goes_here"
    },
    "ice_username": "",
    "log_level": "info",
    "rtsp_port": "",
    "webrtc_port_max": 0,
    "webrtc_port_min": 0
  },
  "streams": {
    "random_generated": {
      "channels": {
        "0": {
          "debug": true,
          "on_demand": true,
          "url": "url?token=secret"
        }
      },
      "name": "streamname"
    }
  }
}

Now when you add new stream you have to add the query param like this with your stream rtsp://127.0.0.1:5541/demo/0?token=you_key

Note: Your endpoint which you use in the token object (your_api_goes_here) should have to return the json having key status and its value would be 0 or 1