feat(auth): add WebAuthn passkey support with migrations, routes, and tests
This commit is contained in:
+11
-1
@@ -7,7 +7,7 @@ use diesel::{
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
auth::jwt::JwtService,
|
||||
auth::{jwt::JwtService, passkeys::PasskeyService},
|
||||
config::AppConfig,
|
||||
db::PgPool,
|
||||
error::{AppError, AppResult},
|
||||
@@ -24,6 +24,7 @@ pub struct AppState {
|
||||
storage: Arc<dyn ObjectStorage>,
|
||||
pub jwt: JwtService,
|
||||
pub tenants: TenantService,
|
||||
pub passkeys: Option<PasskeyService>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
@@ -52,12 +53,21 @@ impl AppState {
|
||||
let config = Arc::new(config);
|
||||
let tenants = TenantService::new(pool.clone());
|
||||
|
||||
let passkeys = match PasskeyService::try_new(&config) {
|
||||
Ok(service) => service,
|
||||
Err(err) => {
|
||||
tracing::warn!(error = ?err, "passkey service disabled due to configuration");
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
Self {
|
||||
pool,
|
||||
config,
|
||||
storage,
|
||||
jwt,
|
||||
tenants,
|
||||
passkeys,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user