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 flagSignature or syntaxPurpose
CLI SAML 2.0 serverlmsaml [--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 bytecodelmsaml [--dry-run] --lmcode prog.dslbExecute or dry-validate compiled LMScript bytecode against the embedded lmsaml schema.
CLI schema and signatureslmsaml --lmcode-schema [--json] | --lmcode-signaturesPrint the embedded schema JSON or all canonical host and lmcode_std_v3 signatures.
SAML 2.0 IdP & SP routesGET /idp/metadata | GET|POST /idp/sso | GET /sp/metadata | POST /sp/acs | GET /sp/helloServe 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 /verifyManage 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 pipelinesaml.batch().ping().add_user(u, json).get_user(u).exec() -> stringQueue multiple SAML directory and assertion operations and execute them as a single JSON array batch.
Standard REST and CLIRestGet..RestOptions, RestHandler, CliCommand, CliOptionExpose _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

Source repository and releases