Skip to content

Commit 2f15cf8

Browse files
authored
fix(jans-fido2): #2971 (#2972)
1 parent 795dccc commit 2f15cf8

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

jans-core/service/src/main/java/io/jans/service/logger/LoggerService.java

+18
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,25 @@
2929

3030
/**
3131
* Logger service
32+
* At startup of any server (FIDO2, jans-auth, casa etc)
33+
* LoggerService is initialized inside the Application Initializer
34+
* (AppInitializer) class for the respective server.
35+
*
36+
* In the server configuration for each application fido2, jans-auth,casa etc,
37+
* you can change the log level and the same is reflected in the corresponding
38+
* log level database entry
39+
*
40+
* And this service/timer will update log level in all created loggers
41+
*
42+
* There are 2 limitations of this Timer
43+
*
44+
* 1. It updates log level only after server startup. First time it does this
45+
* after 15 seconds delay. 2. It can update logging level only after
46+
* instantiating loggers. This means that if no one call specific service with
47+
* own logger this logger will be not created But after first call logger timer
48+
* will update it level as well
3249
*
50+
*
3351
* @author Yuriy Movchan Date: 08/19/2018
3452
*/
3553
public abstract class LoggerService {

jans-fido2/server/src/main/java/io/jans/fido2/service/mds/AttestationCertificateService.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,19 @@ public void init(@Observes @ApplicationInitialized(ApplicationScoped.class) Obje
8484
public List<X509Certificate> getAttestationRootCertificates(JsonNode metadataNode,
8585
List<X509Certificate> attestationCertificates) {
8686
JsonNode metaDataStatement = null;
87-
try {
88-
metaDataStatement = dataMapperService.readTree(metadataNode.get("metadataStatement").toPrettyString());
89-
} catch (IOException e) {
90-
log.error("Error parsing the metadata statement", e);
87+
// incase of u2f-fido2 attestation
88+
if (metadataNode != null) {
89+
try {
90+
metaDataStatement = dataMapperService.readTree(metadataNode.get("metadataStatement").toPrettyString());
91+
} catch (IOException e) {
92+
log.error("Error parsing the metadata statement", e);
93+
}
9194
}
9295

93-
if (metaDataStatement == null || !metaDataStatement.has("attestationRootCertificates")) {
96+
if (metadataNode == null || metaDataStatement == null
97+
|| !metaDataStatement.has("attestationRootCertificates")) {
9498
List<X509Certificate> selectedRootCertificate = certificateService
9599
.selectRootCertificates(rootCertificatesMap, attestationCertificates);
96-
97100
return selectedRootCertificate;
98101
}
99102

jans-fido2/server/src/main/resources/log4j2.xml

+1-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@
3232
<!-- ############### Gluu ################# -->
3333
<Logger name="org.gluu" level="${log4j.default.log.level}" />
3434

35-
<Logger name="io.jans.fido2" level="INFO">
36-
<AppenderRef ref="FILE" />
37-
</Logger>
38-
39-
<Logger name="org.gluu.site.ldap" level="${log4j.default.log.level}" additivity="false">
35+
<Logger name="org.gluu.site.ldap" level="${log4j.default.log.level}" additivity="false">
4036
<AppenderRef ref="PERSISTENCE_FILE" />
4137
</Logger>
4238

0 commit comments

Comments
 (0)