Christopher Vagnetoft af9211349d Initial commit
* Database persistence using SQLite (via Doctrine DBAL)
* Identity management (create, query) keyed by sequential id and uuid
* Basic token-based security with per attribute permissions
* Build phar, docker container, debian package
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00
2025-04-21 16:03:30 +02:00

IdentDB

This is an ad-hoc database for storing identities and associated metadata. These identities will generally be users. Identities don't have usernames, but are instead identified using either numerical ids or uuid strings. They don't have passwords either, but they can contain hashed passwords for authenticating using a different service.

Features

  • Simple to use and integrate - uses standard HTTP GET, POST and DELETE requests.
  • Attribute-level Access control - create a token that can only read certain attributes, and only those attributes will be returned in queries.
  • Flexible access - query identities using id or uuid.

Backends

Backends are queried to populate and update the database.

backends:
  {name}:
    adapter: {adapter}
    options: {options[]}
    stale: {secs}
adapter
The adapter to use.
options
Object of options to pass to the backend
stale
The number of seconds before the local record is assumed stale, and the backend should be queried for fresh data.

'hub' Backend (ZoneKit Hub)

The Hub backend retrieves data from a ZoneKit Hub server.

options.server
The schema, server name and port for the Hub server (ex. http://hub:8000)
options.token
The token to use for authenticating with the Hub

Access tokens

Edit the etc/security.yaml file and configure the tokens section.

If you want to allow full read-write access to a token, set write: true. If you want full read access, set read: true. You can also configure an array of keys that can be read or written.

tokens:
- token: {token}
  read: {true|array|null}
  write: {true|array|null}

Tokens should be passed in the X-Token HTTP header.

Usage

GET /ident/id/42
X-Token: thisismysecrettoken
——
200 OK
Content-Type: application/json

{
  "id": 42,
  "uuid": "b810c577-7e9f-4079-bb81-cafe63aad633",
  "attr": {
    "guest": {
      "name": "Some Guest",
    },
    "stay": {
      "current": true,
      "from": "2025-06-01 13:10:24 +02:00",
      "to": "2025-09-01 13:00:00 +02:00"
    },
    "group": {
      "guest": "member"
    },
    "credentials": {
      "pin": "4219"
    }
  }
}

Endpoints

POST /ident
Create a new user record
GET /ident/id/{id}
Retrieve a user record
GET /ident/uuid/{uuid}
Retrieve a user record
POST /ident/id/{id}
Patch a user record
POST /ident/uuid/{uuid}
Patch a user record
DELETE /ident/id/{id}
Delete a user record
DELETE /ident/uuid/{uuid}
Delete a user record
Description
No description provided
Readme 56 KiB
Languages
PHP 96.3%
Makefile 2.2%
Dockerfile 1.5%