2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.ccsdk.apps.ms.neng.core;
23 import org.onap.ccsdk.apps.ms.neng.core.rs.interceptors.AaiAuthorizationInterceptor;
24 import org.onap.ccsdk.apps.ms.neng.core.rs.interceptors.PolicyManagerAuthorizationInterceptor;
25 import org.springframework.boot.web.client.RestTemplateBuilder;
26 import org.springframework.context.annotation.Bean;
27 import org.springframework.context.annotation.Configuration;
28 import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
29 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
32 * Configuration for the API part of the micro-service.
35 public class WebConfiguration {
37 * Creates the bean for configuring swagger.
40 public WebMvcConfigurer forwardToIndex() {
41 return new WebMvcConfigurer() {
43 public void addViewControllers(ViewControllerRegistry registry) {
44 registry.addViewController("/swagger").setViewName("redirect:/swagger/index.html");
45 registry.addViewController("/swagger/").setViewName("redirect:/swagger/index.html");
46 registry.addViewController("/docs").setViewName("redirect:/docs/html/index.html");
47 registry.addViewController("/docs/").setViewName("redirect:/docs/html/index.html");
53 * Creates the bean for configuring policy manager interceptor.
56 public RestTemplateBuilder policyMgrRestTempBuilder(PolicyManagerAuthorizationInterceptor auth) {
57 RestTemplateBuilder restTemplateBuiler = new RestTemplateBuilder();
58 return restTemplateBuiler.additionalInterceptors(auth);
62 * Creates the bean for configuring A&AI interceptor.
65 public RestTemplateBuilder aaiRestTempBuilder(AaiAuthorizationInterceptor auth) {
66 RestTemplateBuilder restTemplateBuiler = new RestTemplateBuilder();
67 return restTemplateBuiler.additionalInterceptors(auth);