authorization

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Access Control Policy Service

  • Go Web Server, to create access policies and ask for permissions of a subject

Endpoints

  • /policies - manage access policies; every method needs a token with the realm role admin (401 without, 403 without admin), as do /test and /access
curl -i -X POST -H 'Authorization: Bearer <admin token>' --url http://localhost:8080/policies
[
    {
        	"Subject": "admin",
        	"Action": "POST",
        	"Resource": "/iot-repository",
        	"ID": "admin",
        	"Effect": "allow"
    }
]
curl -i -X PUT -H 'Authorization: Bearer <admin token>' --url http://localhost:8080/policies
[
    {
        	"Subject": "admin",
        	"Action": "has_access_permission",
        	"Resource": "deviceid"
        	"ID": "admin",
        	"Context": {
        		"type": "device",
        		"owner": "user"
        	}
        	"Effect": "allow"
    }
]
curl -i -X GET -H 'Authorization: Bearer <admin token>' --url http://localhost:8080/policies?subject=admin
curl -i -X DELETE -H 'Authorization: Bearer <admin token>' --url http://localhost:8080/policies?ids=id1,id2
  • /check - ask for permission (used with kong middleman plugin)
curl -i -X POST --url http://localhost:8080/check
{
    "headers": {
        "target_method": "GET",
        "target_uri": "/process/schedulerlump",
        "authorization": "Bearer <token>"
    }
}

Requiremnets

for project

for Docker image

docker pull golang

Types of authorization

  • Subjects:
  1. User
  2. Role
  • Actions:
  1. HTTP Method
  2. Access
  • Ressources:
  1. URI
  2. Device Instance ID
  3. Device Type ID

Examples

  1. role admin is allowed to GET on ressource /iot-device-repo
  2. user max is allowed to access device instance iot#22323232332 where owner is thomas
  • subset generieren bei web ui: checken eigene devices dann instanzen die freigegeben wurde
  • device instanz verwenden beim process exceuter: entweder im iot-repo nachfragen und ladon

Access Policies

  • one policy per subject e.g. role admin and ressource e.g /iot-repository
  • one or multiple actions which can be removed or added later
  • policy id is tuple of subject and ressource
  • if permissions of a subject in relation to a ressource should be changed, then the existing policy should be changed and no extra policy be created

Naming Convention

Build

with Docker

docker build -t ladon .

Run

with docker-compose (with database and port 8080)

docker-compose up 

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
pkg
api
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL