kochab/examples/user_management.rs

34 lines
1005 B
Rust
Raw Normal View History

2020-11-16 06:13:16 +00:00
use anyhow::*;
use log::LevelFilter;
use northstar::{
GEMINI_PORT,
Request,
Response,
Server,
2020-11-22 04:03:56 +00:00
user_management::UserManagementRoutes,
2020-11-16 06:13:16 +00:00
};
#[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)
2020-11-22 04:03:56 +00:00
.add_um_routes::<String>("/")
.serve()
2020-11-16 06:13:16 +00:00
.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.
2020-11-22 04:03:56 +00:00
async fn handle_request(_request: Request) -> Result<Response> {
Ok(Response::success_plain("Base handler"))
2020-11-16 06:13:16 +00:00
}