Getting Started
Official Site
Getting Started
Official Site
  • Document description
  • Read before you start

  • Light application development guide

  • Mobile application development guide

  • Cloud live development guide

  • Desktop application development guide

  • Third party development guide

  • Message push development guide

  • IoT things data model

  • HTTP interface

    • Development specification
    • API privacy policy
    • Postman interface simulation call
    • accessToken: Get administrator token
    • API request example
    • Account docking
      • Subaccount function description
      • createSubAccount: Create Sub Account
      • getOpenIdByAccount: Get openid based on sub-account
      • deleteSubAccount: Delete subaccount
      • listSubAccount: Get the list of sub-accounts
      • subAccountToken: Get subaccount token
      • addPolicy: Add sub-account permissions
      • clearPolicy: Clear sub-account authorization policy
      • queryDevicePermission: Sub-account device dimension permission
      • deleteDevicePermission: Delete sub-account device permission
      • listSubAccountDevice: Query the list of devices with permissions for the sub-account
    • Push configuration
    • Cloud storage service
    • Equipment management

    • Device configurat

    • Video equipment

    • Device message
    • Device live broadcast
    • Device lock access
  • Reference documents

On this page
Function Description
Why use sub-account docking mode
basic concepts
Sub-account authorization policy (Policy) configuration
Configuration Rules
Statement
permission
Resource
Affiliation

Sub-account Function Description - Imou Open Platform

Sub-account function description

Function Description

The main function of the sub-account docking mode is to control the permissions of the developer's administrator account. By using the sub-account docking mode, you can create sub-accounts within the permissions of the developer's administrator account, and assign different permissions to different sub-accounts to achieve authorization. The purpose of management.

Why use sub-account docking mode

A core problem that sub-accounts need to solve is how to safely authorize others to access the device without exposing the developer's AccessToken. Because once the developer's AccessToken is exposed, it will bring security risks, and others can have the opportunity to operate all device resources under the developer's administrator account.

The sub-account function is a long-term effective permission control mechanism. By separating sub-accounts with different permissions, different permissions are assigned to different users, so that once the sub-account is leaked, it will not cause global information leakage.

basic concepts

The following are some basic concepts of the sub-account docking mode:

Sub-account: The sub-account created from the developer account of easy4ip Open Platform. Each sub-account has an Id.

Authorization policy (Policy): used to define the rules of permissions, such as previewing a certain device.

Resource: The resource that the user can access, such as the device with the serial number of 469631729, or the first channel of the device with the serial number of 469631729;

Sub-account authorization policy (Policy) configuration

There is a Statement in the Policy. The corresponding permissions and resources are specified in the Statement.

The following is an example of an authorization policy (Policy):

{
    "statement": [
        {
            "permission": "Ptz,Talk,Config",
            "resource": [
                "dev:469631729",
                "cam:544229080:1"
            ]
        },
        {
            "permission": "Real",
            "resource": [
                "dev:470686804"
            ]
        }
    ]
}

This Policy authorizes device resources such as 469631729, 544229080, and 470686804 under the developer's administrator account, and supports Ptz, Talk, Config, and Real permissions respectively.

Configuration Rules

Statement

The authorization semantics is described through Statement, each of which contains the description of Permission and Resource. Each time a request is made, the system will match and check one by one. If the match is successful, it is passed, and the request is authenticated. If none of the items match successfully, the request is forbidden to access.

permission

permissionApplicable resource typePermission description
Alarmdev, camDevice alarm message query
Configdev, camDevice configuration permissions
Ptzdev, camPTZ control
Capturedev, camEquipment Capture
UpgradedevDevice Upgrade
FormatdevFormat SD card
Realdev、camReal-time preview
RecordReplaydev, camVideo playback (including cloud video and local video)
Talkdev, camVoice intercom
DevControldev, camComplete device control, including Real, Talk, RecordReplay, Alarm, Capture, Ptz, Upgrade, Format, Config and other currently defined device operation permissions and later defined device operation permissions

Resource

Resource refers to a specific object authorized on the easy4ip open platform. The rule of resource is {resourceType}:{resourceId};

  1. resourceType: Indicates the resource type. There are only 2 resource types, dev (device) and cam (channel);

  2. resourceId: indicates the resource Id, the resourceId of the dev type is the device serial number, and the resourceId of the cam type is the device serial number: channel number.

Affiliation

The cam resource belongs to the dev resource, and the permissions of the sub-account to the dev resource can be passed to the cam resource. For example, there are two resources dev:544229080 and cam:544229080:1, cam:544229080:1 belongs to dev:544229080; if the developer authorizes the Real permission of dev:544229080 resource to the sub-account, the sub-account defaults to cam :544229080:1 has Real authority.

API request example
createSubAccount: Create Sub Account