Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2025-01-31 10:08:56 +01:00
Fix Duo Field Names for Web Client (#5491)
* Fix Duo Field Names for Web Client * Fix Api Validation * Rename Duo Labels In Admin
Dieser Commit ist enthalten in:
Ursprung
a3dccee243
Commit
663f88e717
2 geänderte Dateien mit 13 neuen und 13 gelöschten Zeilen
|
@ -26,8 +26,8 @@ pub fn routes() -> Vec<Route> {
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct DuoData {
|
struct DuoData {
|
||||||
host: String, // Duo API hostname
|
host: String, // Duo API hostname
|
||||||
ik: String, // integration key
|
ik: String, // client id
|
||||||
sk: String, // secret key
|
sk: String, // client secret
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DuoData {
|
impl DuoData {
|
||||||
|
@ -111,8 +111,8 @@ async fn get_duo(data: Json<PasswordOrOtpData>, headers: Headers, mut conn: DbCo
|
||||||
json!({
|
json!({
|
||||||
"enabled": enabled,
|
"enabled": enabled,
|
||||||
"host": data.host,
|
"host": data.host,
|
||||||
"secretKey": data.sk,
|
"clientSecret": data.sk,
|
||||||
"integrationKey": data.ik,
|
"clientId": data.ik,
|
||||||
"object": "twoFactorDuo"
|
"object": "twoFactorDuo"
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -129,8 +129,8 @@ async fn get_duo(data: Json<PasswordOrOtpData>, headers: Headers, mut conn: DbCo
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
struct EnableDuoData {
|
struct EnableDuoData {
|
||||||
host: String,
|
host: String,
|
||||||
secret_key: String,
|
client_secret: String,
|
||||||
integration_key: String,
|
client_id: String,
|
||||||
master_password_hash: Option<String>,
|
master_password_hash: Option<String>,
|
||||||
otp: Option<String>,
|
otp: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -139,8 +139,8 @@ impl From<EnableDuoData> for DuoData {
|
||||||
fn from(d: EnableDuoData) -> Self {
|
fn from(d: EnableDuoData) -> Self {
|
||||||
Self {
|
Self {
|
||||||
host: d.host,
|
host: d.host,
|
||||||
ik: d.integration_key,
|
ik: d.client_id,
|
||||||
sk: d.secret_key,
|
sk: d.client_secret,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ fn check_duo_fields_custom(data: &EnableDuoData) -> bool {
|
||||||
st.is_empty() || s == DISABLED_MESSAGE_DEFAULT
|
st.is_empty() || s == DISABLED_MESSAGE_DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
!empty_or_default(&data.host) && !empty_or_default(&data.secret_key) && !empty_or_default(&data.integration_key)
|
!empty_or_default(&data.host) && !empty_or_default(&data.client_secret) && !empty_or_default(&data.client_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/two-factor/duo", data = "<data>")]
|
#[post("/two-factor/duo", data = "<data>")]
|
||||||
|
@ -186,8 +186,8 @@ async fn activate_duo(data: Json<EnableDuoData>, headers: Headers, mut conn: DbC
|
||||||
Ok(Json(json!({
|
Ok(Json(json!({
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"host": data.host,
|
"host": data.host,
|
||||||
"secretKey": data.sk,
|
"clientSecret": data.sk,
|
||||||
"integrationKey": data.ik,
|
"clientId": data.ik,
|
||||||
"object": "twoFactorDuo"
|
"object": "twoFactorDuo"
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
|
@ -670,9 +670,9 @@ make_config! {
|
||||||
_enable_duo: bool, true, def, true;
|
_enable_duo: bool, true, def, true;
|
||||||
/// Attempt to use deprecated iframe-based Traditional Prompt (Duo WebSDK 2)
|
/// Attempt to use deprecated iframe-based Traditional Prompt (Duo WebSDK 2)
|
||||||
duo_use_iframe: bool, false, def, false;
|
duo_use_iframe: bool, false, def, false;
|
||||||
/// Integration Key
|
/// Client Id
|
||||||
duo_ikey: String, true, option;
|
duo_ikey: String, true, option;
|
||||||
/// Secret Key
|
/// Client Secret
|
||||||
duo_skey: Pass, true, option;
|
duo_skey: Pass, true, option;
|
||||||
/// Host
|
/// Host
|
||||||
duo_host: String, true, option;
|
duo_host: String, true, option;
|
||||||
|
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren