This commit is contained in:
akulikov 2023-05-29 09:31:42 +03:00
parent a5bd6dd1cf
commit 234acc6577

View file

@ -46,12 +46,37 @@ public class GatewayService extends QueueConsumer implements InitializingBean {
}
public RequestInfoUpdate requestOnDemandCompany(BaseRequest<GatewayTaskRequest> userRequest) {
log.debug("LOCM task received");
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
if (requestInfoUpdate != null) return requestInfoUpdate;
String url = formingInboundUrl(inboundServerSettings.getPathLOCM());
String response = restTemplate.getForObject(url, String.class);
log.debug("LOCM task complete, response: {}", response);
return null;
}
public RequestInfoUpdate requestOnDemandSecurity(BaseRequest<GatewayTaskRequest> userRequest) {
log.debug("LOSC task received");
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
if (requestInfoUpdate != null) return requestInfoUpdate;
String url = formingInboundUrl(inboundServerSettings.getPathLOSC());
String response = restTemplate.getForObject(url, String.class);
log.debug("LOSC task complete, response: {}", response);
return null;
}
private String formingInboundUrl(String path) {
return "%s://%s:%s/%s".formatted(
inboundServerSettings.getEnableSsl() ? "https" : "http",
inboundServerSettings.getHost(),
inboundServerSettings.getPort(),
path
);
}
}