etreschenkov 2024-10-03 17:34:45 +03:00
parent 7e2b80b317
commit dccfc37439
4 changed files with 13 additions and 10 deletions

View file

@ -3,6 +3,7 @@ package ru.spcex.clearing.backendapi.controller.queue.misc;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Controller;
@ -14,7 +15,7 @@ import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllRespo
import ru.spcex.clearing.backendapi.security.element.JsConfigSettings;
@Controller
@RequestMapping("/js-config")
@RequestMapping("/")
public class JsConfigController {
private final BackendApiSettings backendApiSettings;
@ -24,13 +25,14 @@ public class JsConfigController {
@ApiOperation(value = "get js config.")
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CommonGetAllResponse.class)})
@RequestMapping(method = RequestMethod.GET)
@RequestMapping(path = "/spcex.config.js", method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> getJsConfig() {
Map<String, Object> result = new HashMap<>();
result.put(JsConfigSettings.SERVER_TITLE_PARAM_NAME, backendApiSettings.getJsConfig().getServerTitle());
result.put(JsConfigSettings.IS_CENTRAL_COUNTER_PARTY_PARAM_NAME, backendApiSettings.getJsConfig().getCentralCounterParty());
String title = new String(backendApiSettings.getJsConfig().getServerTitle().getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
result.put(JsConfigSettings.SERVER_TITLE_PARAM_NAME, title);
result.put(JsConfigSettings.IS_CENTRAL_COUNTER_PARTY_PARAM_NAME, backendApiSettings.getJsConfig().getCentralCounterPartyEnable());
return result;
}

View file

@ -65,6 +65,7 @@ public class WebSecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
.antMatchers("/login").permitAll()
.antMatchers("/error").permitAll()
.antMatchers("/backend-api-login/**").permitAll()
.antMatchers("/spcex.config.js").permitAll()
.anyRequest();
if (securityDisabled) {
anyReq.permitAll();

View file

@ -4,7 +4,7 @@ public class JsConfigSettings {
public final static String SERVER_TITLE_PARAM_NAME = "serverTitle";
public final static String IS_CENTRAL_COUNTER_PARTY_PARAM_NAME = "isCentralCounterparty";
private String serverTitle;
private Boolean isCentralCounterParty;
private Boolean centralCounterPartyEnable;
public String getServerTitle() {
return serverTitle;
@ -14,11 +14,11 @@ public class JsConfigSettings {
this.serverTitle = serverTitle;
}
public Boolean getCentralCounterParty() {
return isCentralCounterParty;
public Boolean getCentralCounterPartyEnable() {
return centralCounterPartyEnable;
}
public void setCentralCounterParty(Boolean centralCounterParty) {
isCentralCounterParty = centralCounterParty;
public void setCentralCounterPartyEnable(Boolean centralCounterPartyEnable) {
this.centralCounterPartyEnable = centralCounterPartyEnable;
}
}

View file

@ -28,7 +28,7 @@ backend-api.kafka-consumer.buffer-memory=33554432
backend-api.security.authorization-disabled=false
backend-api.js-config.server-title=?????? 183
backend-api.js-config.is-central-counter-party=true
backend-api.js-config.central-counter-party-enable=true
#access logs, sample
#server.tomcat.accesslog.directory=logs
#server.tomcat.accesslog.enabled=true