From 629cdedca4e704eb241c4ef0a9ae40297c04d997 Mon Sep 17 00:00:00 2001 From: Madhumita Date: Mon, 14 Nov 2022 14:00:13 +0530 Subject: [PATCH] fix(jans-fido2): #2971 --- .../io/jans/service/logger/LoggerService.java | 18 ++++++++++++++++++ .../mds/AttestationCertificateService.java | 15 +++++++++------ .../server/src/main/resources/log4j2.xml | 6 +----- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/jans-core/service/src/main/java/io/jans/service/logger/LoggerService.java b/jans-core/service/src/main/java/io/jans/service/logger/LoggerService.java index 10df13f7e57..8c43be36d22 100644 --- a/jans-core/service/src/main/java/io/jans/service/logger/LoggerService.java +++ b/jans-core/service/src/main/java/io/jans/service/logger/LoggerService.java @@ -29,7 +29,25 @@ /** * Logger service + * At startup of any server (FIDO2, jans-auth, casa etc) + * LoggerService is initialized inside the Application Initializer + * (AppInitializer) class for the respective server. + * + * In the server configuration for each application fido2, jans-auth,casa etc, + * you can change the log level and the same is reflected in the corresponding + * log level database entry + * + * And this service/timer will update log level in all created loggers + * + * There are 2 limitations of this Timer + * + * 1. It updates log level only after server startup. First time it does this + * after 15 seconds delay. 2. It can update logging level only after + * instantiating loggers. This means that if no one call specific service with + * own logger this logger will be not created But after first call logger timer + * will update it level as well * + * * @author Yuriy Movchan Date: 08/19/2018 */ public abstract class LoggerService { diff --git a/jans-fido2/server/src/main/java/io/jans/fido2/service/mds/AttestationCertificateService.java b/jans-fido2/server/src/main/java/io/jans/fido2/service/mds/AttestationCertificateService.java index dc7ba20152e..cc09d6de4e7 100644 --- a/jans-fido2/server/src/main/java/io/jans/fido2/service/mds/AttestationCertificateService.java +++ b/jans-fido2/server/src/main/java/io/jans/fido2/service/mds/AttestationCertificateService.java @@ -84,16 +84,19 @@ public void init(@Observes @ApplicationInitialized(ApplicationScoped.class) Obje public List getAttestationRootCertificates(JsonNode metadataNode, List attestationCertificates) { JsonNode metaDataStatement = null; - try { - metaDataStatement = dataMapperService.readTree(metadataNode.get("metadataStatement").toPrettyString()); - } catch (IOException e) { - log.error("Error parsing the metadata statement", e); + // incase of u2f-fido2 attestation + if (metadataNode != null) { + try { + metaDataStatement = dataMapperService.readTree(metadataNode.get("metadataStatement").toPrettyString()); + } catch (IOException e) { + log.error("Error parsing the metadata statement", e); + } } - if (metaDataStatement == null || !metaDataStatement.has("attestationRootCertificates")) { + if (metadataNode == null || metaDataStatement == null + || !metaDataStatement.has("attestationRootCertificates")) { List selectedRootCertificate = certificateService .selectRootCertificates(rootCertificatesMap, attestationCertificates); - return selectedRootCertificate; } diff --git a/jans-fido2/server/src/main/resources/log4j2.xml b/jans-fido2/server/src/main/resources/log4j2.xml index bdbea76c1a8..144d998c690 100644 --- a/jans-fido2/server/src/main/resources/log4j2.xml +++ b/jans-fido2/server/src/main/resources/log4j2.xml @@ -32,11 +32,7 @@ - - - - - +