Run the example
You will run one program that plays both sides of a login. It prints alice@example.com. You need Rust 1.88 or newer and a checkout of this repository.
Run it
Section titled “Run it”From a checkout of main, run the example from the repository root with current stable Rust.
cargo run -p saml-rs --example ssoThe first build compiles the crate and bergshamra. The last line is:
SP <- authenticated = alice@example.comThe request id changes every run. The example does not open a browser. It posts the same fields a browser would.
Run on Rust 1.88
Section titled “Run on Rust 1.88”The checkout’s Cargo.lock can pin dependencies that require newer Rust.
Select Rust 1.88 before you run these commands. If you use rustup, set a
toolchain override in the checkout with rustup override set 1.88.
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback cargo updatecargo run -p saml-rs --example ssocargo update rewrites the checkout’s lockfile. Keep that change local.
Replay storage and metadata trust
Section titled “Replay storage and metadata trust”The example imports unsigned metadata and keeps replay identifiers in memory for one run. In a deployment, pin the metadata signing certificate and share the replay cache across requests. See the service provider guide.
- Accept the login in your application: Service provider.
- Issue the response yourself: Identity provider.
- Source of this lesson:
examples/sso.rs.