all things saml

This commit is contained in:
Anthony Stirling
2024-10-02 23:43:30 +01:00
parent 5832147b30
commit c59d3ff3e0
28 changed files with 777 additions and 303 deletions

View File

@@ -2,41 +2,49 @@ package stirling.software.SPDF.EE;
import java.io.IOException;
import org.springframework.boot.CommandLineRunner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;
import stirling.software.SPDF.model.ApplicationProperties;
import stirling.software.SPDF.utils.GeneralUtils;
@Component
public class LicenseKeyChecker {
@Slf4j
public class LicenseKeyChecker {
private final KeygenLicenseVerifier licenseService;
private final ApplicationProperties applicationProperties;
private static boolean enterpriseEnbaledResult = false;
private boolean enterpriseEnbaledResult = false;
// Inject your license service or configuration
@Autowired
public LicenseKeyChecker(
KeygenLicenseVerifier licenseService, ApplicationProperties applicationProperties) {
this.licenseService = licenseService;
this.applicationProperties = new ApplicationProperties();
this.applicationProperties = applicationProperties;
}
@Scheduled(fixedRate = 604800000) // 7 days in milliseconds
@Scheduled(fixedRate = 604800000, initialDelay = 1000) // 7 days in milliseconds
public void checkLicensePeriodically() {
checkLicense();
}
private void checkLicense() {
if(!applicationProperties.getEnterpriseEdition().isEnabled()) {
enterpriseEnbaledResult = false;
} else {
enterpriseEnbaledResult = licenseService.verifyLicense(applicationProperties.getEnterpriseEdition().getKey());
}
log.info(applicationProperties.toString());
log.info(applicationProperties.getEnterpriseEdition().toString());
if (!applicationProperties.getEnterpriseEdition().isEnabled()) {
System.out.println("gggggg");
enterpriseEnbaledResult = false;
} else {
System.out.println("ssssssssssss");
enterpriseEnbaledResult =
licenseService.verifyLicense(
applicationProperties.getEnterpriseEdition().getKey());
}
}
public void updateLicenseKey(String newKey) throws IOException {
@@ -44,7 +52,7 @@ public class LicenseKeyChecker {
GeneralUtils.saveKeyToConfig("EnterpriseEdition.key", newKey, false);
checkLicense();
}
public boolean getEnterpriseEnabledResult() {
return enterpriseEnbaledResult;
}