Replace the monolithic compose_*/configure author surface with file-level
web|endpoint artifacts, split ext/{web,data,security,net}, and lock
no-degrade rules so the model cannot regress to God-object APIs.
Co-authored-by: Cursor <cursoragent@cursor.com>
1.3 KiB
title: ext/security/auth description: Auth Resource (ADR 0007). import plugin:lib/plugin.mq.md import sys:lib/sys.mq.md import table:lib/table.mq.md
_load
p = > plugin.native_path name="web"
p
plugin.load path=
p
print text=ext/security: native web plugin not found sys.exit code=1
auth
+ `users`
+ `session_ttl`=3600
Session/auth helper. Constructs a config object; login validates against the users table. To gate /admin on this app, use app.auth users=… instead.
_load > web_auth_new users=
userssession_ttl=session_ttl
login
+ `username`
+ `password`
Validate credentials against the users table and create a session. Returns {ok, session_id, username, role}.
users = users
ttl = session_ttl
> web_auth_login username=username password=password users=users session_ttl=ttl
check
+ `session_id`
Returns {ok, username, role} when the session is valid.
> web_auth_check session_id=session_id
logout
+ `session_id`
Destroy the session.
> web_auth_logout session_id=session_id
hash_password
+ `password`
Hash a plaintext password for storage in admin user tables (argon2id). Store the returned hash in the password column; login verifies automatically.
> web_password_hash password=password