https://github.com/realaravinth/actix-auth-middleware
Session management muddleware for actix web
https://github.com/realaravinth/actix-auth-middleware
actix-web authentication-middleware session-management
Last synced: about 1 year ago
JSON representation
Session management muddleware for actix web
- Host: GitHub
- URL: https://github.com/realaravinth/actix-auth-middleware
- Owner: realaravinth
- License: apache-2.0
- Created: 2021-10-15T17:37:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-07T06:04:46.000Z (about 4 years ago)
- Last Synced: 2025-04-13T16:16:11.955Z (about 1 year ago)
- Topics: actix-web, authentication-middleware, session-management
- Language: Rust
- Homepage: https://realaravinth.github.io/actix-auth-middleware/actix_auth_middleware/
- Size: 3.45 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
README
Actix Authentication Middleware
[](https://realaravinth.github.io/actix-auth-middleware/actix_auth_middleware/)
[](https://github.com/realaravinth/actix-auth-middleware/actions/workflows/linux.yml)
[](https://codecov.io/gh/realaravinth/actix-auth-middleware)
[](https://deps.rs/repo/github/realaravinth/actix-auth-middleware)
Checks if session is authenticated
## What
This library provides a generic middleware to protect authenticated
routes from unauthenticated access. The middleware provides options to
customise authentication checking mechanism, which enables it to
support a wide range of session management mechanisms.
If a session is authenticated, then the request will be dispatched to
the matching handler and if unauthenticated, it will be redirected to a
user specified route, ideally a sign in route.
## Usage
Add this to your `Cargo.toml`:
```toml
[dependencies.actix-auth-middleware]
version = "0.2.0"
git = "https://github.com/realaravinth/actix-auth-middleware"
# if using https://crates.io/crates/actix-identity, uncomment the
#following line:
#features = ["actix-identity"]
```
## Example
1. Cookie session management:
source : [`cookie-identity.rs`]("./examples/cookie-identity.rs)
```bash
cargo run --example cookie-identity
```