server/rest: accept also = as token separator

Like we do in Proxmox VE

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-10-30 13:34:21 +01:00
parent 6d8a1ac9e4
commit 625a56b75e

View File

@ -569,8 +569,12 @@ fn extract_auth_data(headers: &http::HeaderMap) -> Option<AuthData> {
}
match headers.get(header::AUTHORIZATION).map(|v| v.to_str()) {
Some(Ok(v)) if v.starts_with("PBSAPIToken ") => {
Some(AuthData::ApiToken(v["PBSAPIToken ".len()..].to_owned()))
Some(Ok(v)) => {
if v.starts_with("PBSAPIToken ") || v.starts_with("PBSAPIToken=") {
Some(AuthData::ApiToken(v["PBSAPIToken ".len()..].to_owned()))
} else {
None
}
},
_ => None,
}