Registry / auth / actix-identity

actix-identity

JSON →
library0.9.0rscratesunverified

Identity management for Actix Web, providing session-based user authentication.

# Cargo.toml [dependencies] actix-identity = "0.9.0"
INSTALL
IMPORT
SIG · ACTIX-IDENTITY
A
actix-identity
authrustv0.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Identity
use actix_identity::Identity;

Set up Actix Web with identity middleware and a protected endpoint.

use actix_web::{web, App, HttpServer, HttpResponse}; use actix_identity::{Identity, IdentityMiddleware}; async fn index(user: Option<Identity>) -> HttpResponse { if let Some(id) = user { HttpResponse::Ok().body(format!("Logged in as {}", id.id().unwrap())) } else { HttpResponse::Unauthorized().finish() } } #[actix_web::main] async fn main() -> std::io::Result<()> { HttpServer::new(|| { App::new() .wrap(IdentityMiddleware::default()) .route("/", web::get().to(index)) }) .bind(("127.0.0.1", 8080))? .run() .await }
Debug
Known issues
gotchaRequires the `actix-web` runtime; not compatible with other async runtimes.
fix
Use only with Actix Web's runtime (e.g., #[actix_web::main]).
affects: >=0.9.0
Upgrade
Version history
0.9.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
46 hits · last 30 days
node
38
OpenAI (training)
1
Resources
actix-identity — cargo add actix-identity · libregistry