From 7c341bb7f05c40b84c0f78a7bfd31d7406040b7c Mon Sep 17 00:00:00 2001 From: liamfallon Date: Tue, 14 Mar 2023 17:10:16 +0000 Subject: Update for SNI checking Update policy/models for SNI checking Issue-ID: POLICY-4474 Change-Id: I394069e90235859bcb9ccd95d92682f73cfa5b86 Signed-off-by: liamfallon --- .../policy/simulators/dmaap/AuthDmaapParameters.json | 1 + .../sim/dmaap/parameters/RestServerParameters.java | 18 +++++++++++------- .../java/org/onap/policy/models/simulators/Main.java | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/dmaap/AuthDmaapParameters.json b/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/dmaap/AuthDmaapParameters.json index 0ef03169a..cd84faf1e 100644 --- a/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/dmaap/AuthDmaapParameters.json +++ b/models-interactions/model-simulators/src/main/resources/org/onap/policy/simulators/dmaap/AuthDmaapParameters.json @@ -4,6 +4,7 @@ "restServerParameters": { "host": "0.0.0.0", "port": 3903, + "sniHostCheck": false, "useHttps": true, "userName": "my-username", "password": "my-password" diff --git a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java index 04d914c1a..4a7b12cbf 100644 --- a/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java +++ b/models-sim/models-sim-dmaap/src/main/java/org/onap/policy/models/sim/dmaap/parameters/RestServerParameters.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019,2023 Nordix Foundation. * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -51,6 +51,8 @@ public class RestServerParameters extends ParameterGroupImpl { private boolean useHttps; + private boolean sniHostCheck; + public RestServerParameters() { super(RestServerParameters.class.getSimpleName()); } @@ -66,16 +68,18 @@ public class RestServerParameters extends ParameterGroupImpl { props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, getName()); final String svcpfx = - PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + getName(); + PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + getName(); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, getHost()); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, - Integer.toString(getPort())); + Integer.toString(getPort())); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX, - DmaapSimRestControllerV1.class.getName()); + DmaapSimRestControllerV1.class.getName()); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "false"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX, Boolean.toString(isUseHttps())); + props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SNI_HOST_CHECK_SUFFIX, + Boolean.toString(isSniHostCheck())); if (getUserName() != null && getPassword() != null) { props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, getUserName()); @@ -83,9 +87,9 @@ public class RestServerParameters extends ParameterGroupImpl { } props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, - String.join(",", CambriaMessageBodyHandler.class.getName(), - GsonMessageBodyHandler.class.getName(), - TextMessageBodyHandler.class.getName())); + String.join(",", CambriaMessageBodyHandler.class.getName(), + GsonMessageBodyHandler.class.getName(), + TextMessageBodyHandler.class.getName())); return props; } } diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java index 5e585b414..e14beab9f 100644 --- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java +++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/Main.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved. + * Modifications Copyright 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -286,6 +287,7 @@ public class Main extends ServiceManagerContainer { params.getProviderClass()); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "false"); + props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SNI_HOST_CHECK_SUFFIX, "false"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "true"); if (dmaapName != null && dmaapName.equals(params.getName())) { -- cgit 1.2.3-korg