-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: #776 * fix: #776 file location corrected * fix: #2503 moved timer task to jans-fido2 project + code formatting
- Loading branch information
Showing
13 changed files
with
1,023 additions
and
332 deletions.
There are no files selected for viewing
747 changes: 636 additions & 111 deletions
747
docs/script-catalog/person_authentication/casa/Casa.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
jans-fido2/server/src/main/java/io/jans/fido2/service/app/MDS3UpdateEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package io.jans.fido2.service.app; | ||
|
||
public interface MDS3UpdateEvent { | ||
|
||
} |
74 changes: 74 additions & 0 deletions
74
jans-fido2/server/src/main/java/io/jans/fido2/service/app/MDS3UpdateTimer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Janssen Project software is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. | ||
* | ||
* Copyright (c) 2020, Janssen Project | ||
*/ | ||
|
||
package io.jans.fido2.service.app; | ||
|
||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.time.LocalDate; | ||
import java.time.temporal.ChronoUnit; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.event.Event; | ||
import jakarta.enterprise.event.Observes; | ||
import jakarta.inject.Inject; | ||
import jakarta.inject.Named; | ||
|
||
import io.jans.fido2.service.mds.TocService; | ||
import io.jans.service.cdi.async.Asynchronous; | ||
import io.jans.service.cdi.event.Scheduled; | ||
import io.jans.service.timer.event.TimerEvent; | ||
import io.jans.service.timer.schedule.TimerSchedule; | ||
import org.slf4j.Logger; | ||
|
||
/** | ||
* @author madhumitas | ||
* | ||
*/ | ||
@ApplicationScoped | ||
@Named | ||
|
||
public class MDS3UpdateTimer { | ||
|
||
private static final int DEFAULT_INTERVAL = 60 * 60 * 24; // every 24 hours | ||
|
||
@Inject | ||
private Logger log; | ||
|
||
@Inject | ||
private Event<TimerEvent> timerEvent; | ||
|
||
@Inject | ||
private TocService tocService; | ||
|
||
public void initTimer() { | ||
log.info("Initializing MDS3 Update Timer"); | ||
|
||
timerEvent.fire(new TimerEvent(new TimerSchedule(DEFAULT_INTERVAL, DEFAULT_INTERVAL), new MDS3UpdateEvent() { | ||
}, Scheduled.Literal.INSTANCE)); | ||
|
||
log.info("Initialized MDS3 Update Timer"); | ||
} | ||
|
||
@Asynchronous | ||
public void process(@Observes @Scheduled MDS3UpdateEvent mds3UpdateEvent) { | ||
LocalDate nextUpdate = tocService.getNextUpdateDate(); | ||
if (nextUpdate.equals(LocalDate.now()) || nextUpdate.isBefore(LocalDate.now())) { | ||
log.info("Downloading the latest TOC from https://mds.fidoalliance.org/"); | ||
try { | ||
tocService.downloadMdsFromServer(new URL("https://mds.fidoalliance.org/")); | ||
|
||
} catch (MalformedURLException e) { | ||
log.error("Error while parsing the FIDO alliance URL :", e); | ||
return; | ||
} | ||
tocService.refresh(); | ||
} else { | ||
log.info("{} more days for MDS3 Update", LocalDate.now().until(nextUpdate, ChronoUnit.DAYS)); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.