Add default clients #105
@ -56,19 +56,28 @@ pub struct WebAuthManager {
|
|||||||
|
|
||||||
impl WebAuthManager {
|
impl WebAuthManager {
|
||||||
pub fn init(conf: &AppConfig) -> Self {
|
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 {
|
Self {
|
||||||
core: WebauthnBuilder::new(
|
core: WebauthnBuilder::new(rp_id, &rp_origin)
|
||||||
conf.domain_name()
|
.expect("Invalid Webauthn configuration")
|
||||||
.split_once(':')
|
.rp_name(APP_NAME)
|
||||||
.map(|s| s.0)
|
.build()
|
||||||
.unwrap_or_else(|| conf.domain_name()),
|
.expect("Failed to build webauthn"),
|
||||||
&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"),
|
|
||||||
crypto_wrapper: CryptoWrapper::new_random(),
|
crypto_wrapper: CryptoWrapper::new_random(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user