3 releases
new 0.0.3 | Mar 17, 2023 |
---|---|
0.0.2 | Mar 10, 2023 |
0.0.1 | Mar 5, 2023 |
#241 in Authentication
57 downloads per month
Used in 2 crates
265KB
7K
SLoC
sylvia-iot-auth
The authentication/authorization module of the Sylvia-IoT platform.
This module provides:
- OAuth2 authorization that supports the following grant flows:
- Authorization code
- Client credentials (to be implemented)
- User management.
- Client management.
Mount sylvia-iot-auth in your Actix-Web App
You can simply mount sylvia-iot-auth into your Actix-Web App:
use actix_web::{self, App, HttpServer};
use clap::App as ClapApp;
use sylvia_iot_auth::{libs, routes};
#[tokio::main]
async fn main() -> std::io::Result<()> {
let args = ClapApp::new("your-project-name").get_matches();
let conf = libs::config::read_args(&args);
let auth_state = match routes::new_state("/auth", &conf).await {
Err(e) => {
println!("Error: {}", e);
return Ok(());
},
Ok(state) => state,
};
HttpServer::new(move || App::new().service(routes::new_service(&auth_state)))
.bind("0.0.0.0:1080")?
.run()
.await
}
Please see src/bin/sylvia-iot-auth.rs
to get the real world example.
Dependencies
~68MB
~1.5M SLoC