Generate state for authentication
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-04-25 15:03:56 +02:00
parent a0325fefbf
commit 0fa58f4d3a
7 changed files with 225 additions and 6 deletions

View File

@@ -12,6 +12,7 @@ use actix_web::{get, middleware, web, App, HttpResponse, HttpServer};
use basic_oidc::actors::bruteforce_actor::BruteForceActor;
use basic_oidc::actors::openid_sessions_actor::OpenIDSessionsActor;
use basic_oidc::actors::providers_states_actor::ProvidersStatesActor;
use basic_oidc::actors::users_actor::{UsersActor, UsersSyncBackend};
use basic_oidc::constants::*;
use basic_oidc::controllers::assets_controller::assets_route;
@@ -69,6 +70,7 @@ async fn main() -> std::io::Result<()> {
let users_actor = UsersActor::new(users).start();
let bruteforce_actor = BruteForceActor::default().start();
let providers_states_actor = ProvidersStatesActor::default().start();
let openid_sessions_actor = OpenIDSessionsActor::default().start();
let jwt_signer = JWTSigner::gen_from_memory().expect("Failed to generate JWKS key");
let webauthn_manager = Arc::new(WebAuthManager::init(config));
@@ -105,6 +107,7 @@ async fn main() -> std::io::Result<()> {
App::new()
.app_data(web::Data::new(users_actor.clone()))
.app_data(web::Data::new(bruteforce_actor.clone()))
.app_data(web::Data::new(providers_states_actor.clone()))
.app_data(web::Data::new(openid_sessions_actor.clone()))
.app_data(web::Data::new(clients.clone()))
.app_data(web::Data::new(providers.clone()))
@@ -117,7 +120,7 @@ async fn main() -> std::io::Result<()> {
.wrap(AuthMiddleware {})
.wrap(identity_middleware)
.wrap(session_mw)
// main route
// Main route
.route(
"/",
web::get().to(|| async {
@@ -127,7 +130,7 @@ async fn main() -> std::io::Result<()> {
}),
)
.route("/robots.txt", web::get().to(assets_controller::robots_txt))
// health route
// Health route
.service(health)
// Assets serving
.route("/assets/{path:.*}", web::get().to(assets_route))
@@ -158,6 +161,11 @@ async fn main() -> std::io::Result<()> {
"/login/api/auth_webauthn",
web::post().to(login_api::auth_webauthn),
)
// Providers controller
.route(
"/login_with_prov",
web::get().to(providers_controller::start_login),
)
// Settings routes
.route(
"/settings",