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
1 changed files with 9 additions and 1 deletions

View File

@ -16,6 +16,7 @@ use std::io::Write;
use std::sync::Arc;
use crate::authentication::fabfire::FabFireCardKey;
use crate::CONFIG;
enum FabFireError {
ParseError,
@ -128,13 +129,20 @@ const MAGIC: &'static str = "FABACCESS\0DESFIRE\01.0\0";
impl FabFire {
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 {
step: Step::New,
card_info: None,
key_info: None,
auth_info: None,
app_id: 0x464142,
local_urn: "urn:fabaccess:lab:innovisionlab".to_string(),
local_urn: "urn:fabaccess:lab:{space}".into(),
desfire: Desfire {
card: None,
session_key: None,