lmsaml
lmsaml is a single-binary SAML 2.0 Identity Provider, Service Provider, REST API server, and LMScript host built in pure Go. It generates RSA-2048 X.509 certificates, serves SAML 2.0 SSO/SLO and metadata endpoints, signs and verifies XML assertions, and runs _lmcode_ scripts.
Quick reference
npm install -g @lmctl-ai/lmctl@latest
lmsaml --version
lmsaml --lmcode-schema --json
lmsaml --lmcode-signatures
| Interface or flag | Signature or syntax | Purpose |
|---|---|---|
| CLI SAML 2.0 server | lmsaml [--port 8080] [--rest-port 8081] [--host 127.0.0.1] [--require-auth] | Start the turnkey SAML 2.0 Identity Provider, built-in Service Provider, and JSON REST API. |
| CLI host bytecode | lmsaml [--dry-run] --lmcode prog.dslb | Execute or dry-validate compiled LMScript bytecode against the embedded lmsaml schema. |
| CLI schema and signatures | lmsaml --lmcode-schema [--json] | --lmcode-signatures | Print the embedded schema JSON or all canonical host and lmcode_std_v3 signatures. |
| SAML 2.0 IdP & SP routes | GET /idp/metadata | GET|POST /idp/sso | GET /sp/metadata | POST /sp/acs | GET /sp/hello | Serve IdP and SP EntityDescriptor XML, Single Sign-On, Assertion Consumer Service, and SP-initiated AuthnRequest redirects. |
| REST directory & assertions | /ping | /users/{id} | /services/{id} | POST /authn | POST /assertion | POST /verify | Manage bcrypt users and SP metadata, authenticate credentials, and issue or verify RSA-SHA256 signed SAML 2.0 responses. |
| context saml: Saml (directory) | saml.ping() | saml.metadata() | saml.sp_metadata() | saml.add_user() | saml.authenticate() | Query IdP/SP metadata, provision and list users, and verify user passwords from LMScript. |
| Saml (assertions) | saml.issue_assertion(user, audience) | saml.verify_assertion(xml_or_b64) | Issue RSA-SHA256 + Exclusive C14N signed SAML 2.0 assertions and cryptographically verify signatures and claims. |
| Batch pipeline | saml.batch().ping().add_user(u, json).get_user(u).exec() -> string | Queue multiple SAML directory and assertion operations and execute them as a single JSON array batch. |
| Standard REST and CLI | RestGet..RestOptions, RestHandler, CliCommand, CliOption | Expose _lmcode_ functions as HTTP routes (:param) or stateless CLI flags and commands via rest_serve and rest_cli. |
p = _lmcode_ cli="lmsaml" install="github:lmctl-ai/lmsaml@latest";
assert_eq(saml.ping(), "PONG");
assert_eq(saml.add_user("alice", "{\"email\":\"alice@example.com\",\"password\":\"secret123\"}"), true);
assert_eq(saml.authenticate("alice", "secret123"), true);
let issued = json_parse(saml.issue_assertion("alice", ""));
let verified = json_parse(saml.verify_assertion(issued.get("saml_response_b64").as_string()));
assert_eq(verified.get("valid").as_bool(), true);
@"/sso-user/:name"
fn get_sso_user(x: RestExchange) -> void implements RestGet {
x.json(saml.get_user(x.param("name")));
}
assert(str_contains(rest_cli(str_split("/sso-user/alice", " ")), "alice@example.com"));
end _lmcode_
res = run_lmcode(p);
require(res.ok, json_stringify(res));
Documentation pages
- Skill — agent authoring rules, server and CLI commands, XML-DSig security rules, exit codes, and verification steps.
- Guide — SAML 2.0 IdP/SP architecture, XML-DSig and XML-Enc security hardening, REST API and Batch execution, and standard REST and CLI interfaces.
- Reference — complete CLI flags, HTTP endpoints, Saml and Batch host methods, standard lmcode_std_v3 interfaces, and exit codes.