Skip to content

Commit

Permalink
fix(jans-fido2): #2971
Browse files Browse the repository at this point in the history
  • Loading branch information
maduvena committed Nov 14, 2022
1 parent fddbc51 commit 629cded
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,19 @@ public void init(@Observes @ApplicationInitialized(ApplicationScoped.class) Obje
public List<X509Certificate> getAttestationRootCertificates(JsonNode metadataNode,
List<X509Certificate> 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<X509Certificate> selectedRootCertificate = certificateService
.selectRootCertificates(rootCertificatesMap, attestationCertificates);

return selectedRootCertificate;
}

Expand Down
6 changes: 1 addition & 5 deletions jans-fido2/server/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@
<!-- ############### Gluu ################# -->
<Logger name="org.gluu" level="${log4j.default.log.level}" />

<Logger name="io.jans.fido2" level="INFO">
<AppenderRef ref="FILE" />
</Logger>

<Logger name="org.gluu.site.ldap" level="${log4j.default.log.level}" additivity="false">
<Logger name="org.gluu.site.ldap" level="${log4j.default.log.level}" additivity="false">
<AppenderRef ref="PERSISTENCE_FILE" />
</Logger>

Expand Down

0 comments on commit 629cded

Please sign in to comment.