Add JWT time.

main
Paulo Gustavo Veiga 2024-02-20 21:52:56 -08:00
parent 849e700ef8
commit 853f500454
2 changed files with 21 additions and 1 deletions

View File

@ -57,6 +57,9 @@ public class AppController extends BaseController {
@Value("${app.analytics.account:}")
private String analyticsAccount;
@Value("${app.jwt.expirationMin:10080}")
private int jwtExpirationMin;
@RequestMapping(method = RequestMethod.GET, value = "/config")
@ResponseStatus(value = HttpStatus.OK)
public RestAppConfig appConfig() {
@ -66,6 +69,7 @@ public class AppController extends BaseController {
.setGoogleOauth2Url(googleOauth2Url)
.setAnalyticsAccount(analyticsAccount)
.setRegistrationEnabled(isRegistrationEnabled)
.setJwtExpirationMin(jwtExpirationMin)
.build();
}

View File

@ -39,6 +39,8 @@ public class RestAppConfig {
private String recaptcha2SiteKey;
private String analyticsAccount;
private int jwtExpirationMin = 10080;
RestAppConfig() {
}
@ -91,6 +93,14 @@ public class RestAppConfig {
this.analyticsAccount = analyticsAccount;
}
public int getJwtExpirationMin() {
return jwtExpirationMin;
}
public void setJwtExpirationMin(int jwtExpirationMin) {
this.jwtExpirationMin = jwtExpirationMin;
}
public static class RestAppConfigBuilder {
private String apiBaseUrl;
private String googleOauth2Url;
@ -99,6 +109,8 @@ public class RestAppConfig {
private String captchaSiteKey;
private String analyticsAccount;
private int jwtExpirationMin;
public RestAppConfigBuilder setCaptchaSiteKey(@NotNull String captchaSiteKey) {
this.captchaSiteKey = captchaSiteKey;
this.isCatchaEnabled = true;
@ -110,6 +122,11 @@ public class RestAppConfig {
return this;
}
public RestAppConfigBuilder setJwtExpirationMin(@NotNull int value) {
this.jwtExpirationMin = value;
return this;
}
public RestAppConfigBuilder setGoogleOauth2Url(@NotNull String googleOauth2Url) {
this.googleOauth2Url = googleOauth2Url;
return this;
@ -141,5 +158,4 @@ public class RestAppConfig {
return result;
}
}
}