check the configured space urn and not a hardcoded one

This commit is contained in:
Kai Jan Kriegel 2023-02-03 21:35:53 +01:00
parent 4cdbfd8925
commit 55e9bf6e2b

View File

@ -16,6 +16,7 @@ use std::io::Write;
use std::sync::Arc; use std::sync::Arc;
use crate::authentication::fabfire::FabFireCardKey; use crate::authentication::fabfire::FabFireCardKey;
use crate::CONFIG;
enum FabFireError { enum FabFireError {
ParseError, ParseError,
@ -128,13 +129,20 @@ const MAGIC: &'static str = "FABACCESS\0DESFIRE\01.0\0";
impl FabFire { impl FabFire {
pub fn new_server(_sasl: &SASLConfig) -> Result<Box<dyn Authentication>, SASLError> { pub fn new_server(_sasl: &SASLConfig) -> Result<Box<dyn Authentication>, SASLError> {
let space = if let Some(space) = CONFIG.get().map(|c| c.spacename.as_str()) {
space
} else {
tracing::error!("No space configured");
"generic"
};
Ok(Box::new(Self { Ok(Box::new(Self {
step: Step::New, step: Step::New,
card_info: None, card_info: None,
key_info: None, key_info: None,
auth_info: None, auth_info: None,
app_id: 0x464142, app_id: 0x464142,
local_urn: "urn:fabaccess:lab:innovisionlab".to_string(), local_urn: "urn:fabaccess:lab:{space}".into(),
desfire: Desfire { desfire: Desfire {
card: None, card: None,
session_key: None, session_key: None,