Add default clients (#105)
All checks were successful
continuous-integration/drone/push Build is passing

* Add the possibility to create client enabled by default when creating new accounts
* Can mark clients are granted for all users, regardless of users accounts grants

Reviewed-on: #105
This commit is contained in:
2023-04-15 10:19:15 +00:00
parent f1ac19cca1
commit 6d2e52d632
10 changed files with 493 additions and 328 deletions

View File

@ -56,19 +56,28 @@ pub struct WebAuthManager {
impl WebAuthManager {
pub fn init(conf: &AppConfig) -> Self {
let rp_id = conf
.domain_name()
.split_once(':')
.map(|s| s.0)
.unwrap_or_else(|| conf.domain_name());
let rp_origin =
url::Url::parse(&conf.website_origin).expect("Failed to parse configuration origin!");
log::debug!(
"rp_id={} rp_origin={} rp_origin_domain={:?}",
rp_id,
rp_origin,
rp_origin.domain()
);
Self {
core: WebauthnBuilder::new(
conf.domain_name()
.split_once(':')
.map(|s| s.0)
.unwrap_or_else(|| conf.domain_name()),
&url::Url::parse(&conf.website_origin)
.expect("Failed to parse configuration origin!"),
)
.expect("Invalid Webauthn configuration")
.rp_name(APP_NAME)
.build()
.expect("Failed to build webauthn"),
core: WebauthnBuilder::new(rp_id, &rp_origin)
.expect("Invalid Webauthn configuration")
.rp_name(APP_NAME)
.build()
.expect("Failed to build webauthn"),
crypto_wrapper: CryptoWrapper::new_random(),
}
}