@@ -0,0 +1,2424 @@
+package com.orange.oss.cloudfoundry.cscpi.config;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.beans.factory.annotation.Value;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.core.annotation.Order;%0Aimport org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;%0Aimport org.springframework.security.config.annotation.web.builders.HttpSecurity;%0Aimport org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;%0Aimport org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;%0A%0A@EnableWebSecurity%0Apublic class WebSecurityConfig %7B%0A%0A    @Value(%22$%7Bbroker.username:user%7D%22)%0A    private String brokerUsername;%0A    @Value(%22$%7Bbroker.password:password%7D%22)%0A    private String brokerPassword;%0A%0A    @Value(%22$%7Badmin.username:admin%7D%22)%0A    private String adminUsername;%0A    @Value(%22$%7Badmin.password:password%7D%22)%0A    private String adminPassword;%0A%0A    @Autowired%0A    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception %7B%0A        auth.inMemoryAuthentication().withUser(brokerUsername).password(brokerPassword).roles(%22API%22);%0A        auth.inMemoryAuthentication().withUser(adminUsername).password(adminPassword).roles(%22REGISTRY%22);%0A    %7D%0A%0A%0A    @Configuration%0A    @Order(1)%0A    public static class ServiceBrokerSecurity extends WebSecurityConfigurerAdapter %7B%0A%0A        @Override%0A        protected void configure(HttpSecurity http) throws Exception %7B%0A            http%0A                    .antMatcher(%22/cpi/**%22)%0A                    .authorizeRequests()%0A                    .anyRequest();%0A//                    .hasRole(%22API%22)%0A//                    .and()%0A//                    .httpBasic()%0A//                    .and()%0A//                    .csrf().disable();%0A        %7D%0A    %7D%0A    %0A//    @Configuration%0A//    @Order(2)%0A    public static class RegistrySecurity extends WebSecurityConfigurerAdapter %7B%0A%0A        @Override%0A        protected void configure(HttpSecurity http) throws Exception %7B%0A            http%0A                    .antMatcher(%22/registry/**%22)%0A                    .authorizeRequests()%0A                    .anyRequest()%0A                    .hasRole(%22REGISTRY%22)%0A                    .and()%0A                    .httpBasic()%0A                    .and()%0A                    .csrf().disable();%0A        %7D%0A    %7D%0A    %0A    %0A    %0A    %0A%7D%0A

add security config for rest access