Loading src/main/java/org/etsi/osl/osom/lcm/SecretsClient.java +18 −2 Original line number Diff line number Diff line Loading @@ -7,10 +7,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @Service @ConditionalOnExpression("${SECRETS_CONTROLLER_ENABLE:false}") public class SecretsClient { private static final transient Log logger = LogFactory.getLog( SecretsClient.class.getName() ); private final ProducerTemplate producerTemplate; private final String unsealSecretQueue; Loading @@ -31,14 +37,24 @@ public class SecretsClient { final var cmd = new UnsealCharacteristicCommand(uri, characteristic); final var payload = this.mapper.writeValueAsString(cmd); final var responseRaw = this.producerTemplate.requestBody(this.unsealSecretQueue, payload, String.class); if (responseRaw == null || responseRaw.isEmpty()) { return uri; } final var response = this.mapper.readValue(responseRaw, String.class); if (response == null) return ""; if (response == null || response.isEmpty()) { return uri; } return response; } catch (JsonProcessingException e) { throw new RuntimeException(e); } catch (Exception e) { // controller is enabled by the request failed (no route, timeout, broker down) logger.warn("Secrets controller did not respond for " + uri, e); return uri; } } Loading Loading
src/main/java/org/etsi/osl/osom/lcm/SecretsClient.java +18 −2 Original line number Diff line number Diff line Loading @@ -7,10 +7,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Service; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @Service @ConditionalOnExpression("${SECRETS_CONTROLLER_ENABLE:false}") public class SecretsClient { private static final transient Log logger = LogFactory.getLog( SecretsClient.class.getName() ); private final ProducerTemplate producerTemplate; private final String unsealSecretQueue; Loading @@ -31,14 +37,24 @@ public class SecretsClient { final var cmd = new UnsealCharacteristicCommand(uri, characteristic); final var payload = this.mapper.writeValueAsString(cmd); final var responseRaw = this.producerTemplate.requestBody(this.unsealSecretQueue, payload, String.class); if (responseRaw == null || responseRaw.isEmpty()) { return uri; } final var response = this.mapper.readValue(responseRaw, String.class); if (response == null) return ""; if (response == null || response.isEmpty()) { return uri; } return response; } catch (JsonProcessingException e) { throw new RuntimeException(e); } catch (Exception e) { // controller is enabled by the request failed (no route, timeout, broker down) logger.warn("Secrets controller did not respond for " + uri, e); return uri; } } Loading