kochab/examples/user_management.rs

34 lines
1005 B
Rust

use anyhow::*;
use log::LevelFilter;
use northstar::{
GEMINI_PORT,
Request,
Response,
Server,
user_management::UserManagementRoutes,
};
#[tokio::main]
async fn main() -> Result<()> {
env_logger::builder()
.filter_module("northstar", LevelFilter::Debug)
.init();
Server::bind(("0.0.0.0", GEMINI_PORT))
.add_route("/", handle_request)
.add_um_routes::<String>("/")
.serve()
.await
}
/// An ultra-simple demonstration of simple authentication.
///
/// If the user attempts to connect, they will be prompted to create a client certificate.
/// Once they've made one, they'll be given the opportunity to create an account by
/// selecting a username. They'll then get a message confirming their account creation.
/// Any time this user visits the site in the future, they'll get a personalized welcome
/// message.
async fn handle_request(_request: Request) -> Result<Response> {
Ok(Response::success_plain("Base handler"))
}