2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.openecomp.policy.pypdp.controller;
23 import javax.servlet.Filter;
25 import org.openecomp.policy.pypdp.authorization.AuthenticationFilter;
26 import org.springframework.boot.SpringApplication;
27 import org.springframework.boot.autoconfigure.SpringBootApplication;
28 import org.springframework.boot.builder.SpringApplicationBuilder;
29 import org.springframework.boot.context.web.SpringBootServletInitializer;
30 import org.springframework.context.annotation.Bean;
31 import org.springframework.context.annotation.ComponentScan;
33 import springfox.documentation.builders.ApiInfoBuilder;
34 import springfox.documentation.builders.RequestHandlerSelectors;
35 import springfox.documentation.service.ApiInfo;
36 import springfox.documentation.service.Contact;
37 import springfox.documentation.spi.DocumentationType;
38 import springfox.documentation.spring.web.plugins.Docket;
39 import springfox.documentation.swagger2.annotations.EnableSwagger2;
41 @SpringBootApplication
43 @ComponentScan(basePackageClasses = {PolicyEngineServices.class})
44 public class Application extends SpringBootServletInitializer {
46 public static void main(String[] args) {
47 SpringApplication.run(Application.class, args);
51 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
52 return application.sources(applicationClass);
55 private static Class<Application> applicationClass = Application.class;
58 public Filter authenticationFilter(){
59 return new AuthenticationFilter();
62 private ApiInfo apiInfo(){
63 return new ApiInfoBuilder()
64 .title("Policy Engine REST API")
65 .description("This API helps applications across Domain 2.0 Platform to make queries against Policy Engine")
71 public Docket policyAPI(){
72 return new Docket(DocumentationType.SWAGGER_2)
75 .apis(RequestHandlerSelectors.basePackage("org.openecomp.policy.pypdp.controller"))