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

View file

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

View file

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

View file

@ -28,7 +28,7 @@ backend-api.kafka-consumer.buffer-memory=33554432
backend-api.security.authorization-disabled=false backend-api.security.authorization-disabled=false
backend-api.js-config.server-title=?????? 183 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 #access logs, sample
#server.tomcat.accesslog.directory=logs #server.tomcat.accesslog.directory=logs
#server.tomcat.accesslog.enabled=true #server.tomcat.accesslog.enabled=true