Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Added scheduled call to app token dataservice
Browse files Browse the repository at this point in the history
  • Loading branch information
lmeinen committed Jun 25, 2021
1 parent 5f02ae8 commit 7888c9d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ch.admin.bag.covidcertificate.backend.verifier.ws.config;

import ch.admin.bag.covidcertificate.backend.verifier.data.AppTokenDataService;
import ch.admin.bag.covidcertificate.backend.verifier.model.AppToken;
import ch.admin.bag.covidcertificate.backend.verifier.ws.config.model.ApiKeyConfig;
import java.util.List;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Configuration
@EnableScheduling
public class WSSchedulingConfig {

private final ApiKeyConfig apiKeyConfig;
private final AppTokenDataService appTokenDataService;

public WSSchedulingConfig(
ApiKeyConfig apiKeyConfig,
AppTokenDataService appTokenDataService) {
this.apiKeyConfig = apiKeyConfig;
this.appTokenDataService = appTokenDataService;
}

@Scheduled(cron = "${ws.authentication.cron:0 0/5 0 ? * *}")
public void updateAppTokens() {
final var appTokens = appTokenDataService.getAppTokens();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

package ch.admin.bag.covidcertificate.backend.verifier.ws.config;

import ch.admin.bag.covidcertificate.backend.verifier.data.AppTokenDataService;
import ch.admin.bag.covidcertificate.backend.verifier.data.VerifierDataService;
import ch.admin.bag.covidcertificate.backend.verifier.data.impl.JdbcAppTokenDataServiceImpl;
import ch.admin.bag.covidcertificate.backend.verifier.data.impl.JdbcVerifierDataServiceImpl;
import ch.admin.bag.covidcertificate.backend.verifier.ws.controller.KeyController;
import ch.admin.bag.covidcertificate.backend.verifier.ws.controller.RevocationListController;
Expand Down Expand Up @@ -128,6 +130,11 @@ public VerifierDataService verifierDataService(DataSource dataSource) {
return new JdbcVerifierDataServiceImpl(dataSource);
}

@Bean
public AppTokenDataService appTokenDataService(DataSource dataSource) {
return new JdbcAppTokenDataServiceImpl(dataSource);
}

@Bean
public KeyController keyController(VerifierDataService verifierDataService) {
return new KeyController(verifierDataService);
Expand Down

0 comments on commit 7888c9d

Please sign in to comment.