2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
20 package org.onap.so.asdc.etsi.pkg.processor;
22 import java.nio.charset.StandardCharsets;
23 import java.security.GeneralSecurityException;
24 import org.apache.commons.codec.binary.Base64;
25 import org.onap.so.utils.CryptoUtils;
26 import org.springframework.beans.factory.annotation.Value;
27 import org.springframework.context.annotation.Configuration;
30 * @author Waqas Ikram (waqas.ikram@est.tech)
34 public class SdcBasicHttpConfigurationProvider {
36 @Value("${sdc.endpoint:https://sdc-be.onap:8443}")
37 private String endPoint;
39 @Value("${sdc.username:mso}")
40 private String username;
42 @Value(value = "${sdc.password:76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F}")
43 private String password;
45 @Value(value = "${sdc.key:566B754875657232314F5548556D3665}")
49 public String getBasicAuthorization() throws GeneralSecurityException {
50 final String auth = username + ":" + CryptoUtils.decrypt(password, key);
51 final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
52 return "Basic " + new String(encodedAuth);
55 public String getEndPoint() {