+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.security;\r
-\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-import org.springframework.beans.factory.annotation.Value;\r
-import org.springframework.context.annotation.Bean;\r
-import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;\r
-import org.springframework.security.config.web.server.ServerHttpSecurity;\r
-import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;\r
-import org.springframework.security.core.userdetails.User;\r
-import org.springframework.security.core.userdetails.UserDetails;\r
-import org.springframework.security.web.server.SecurityWebFilterChain;\r
-\r
-@SuppressWarnings("unused")\r
-@EnableWebFluxSecurity\r
-public class ApplicationSecurityConfigurerAdapter {\r
-\r
- @Value("${basic-auth.user-name}")\r
- private String userName;\r
-\r
- @Value("${basic-auth.hashed-pwd}")\r
- private String userHashedPassword;\r
-\r
- private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationSecurityConfigurerAdapter.class);\r
-\r
- @Bean\r
- public SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) throws Exception {\r
-\r
- http.csrf().disable();\r
- http.authorizeExchange()\r
- .pathMatchers("/webjars/**", "/actuator/**").permitAll()\r
- .anyExchange().authenticated()\r
- .and().httpBasic();\r
-\r
- return http.build();\r
- }\r
-\r
- @Bean\r
- public MapReactiveUserDetailsService userDetailsService() {\r
- User.UserBuilder userBuilder = User.builder();\r
- UserDetails defaultUser = userBuilder\r
- .username(userName)\r
- .password(userHashedPassword).roles("USER").build();\r
- return new MapReactiveUserDetailsService(defaultUser);\r
- }\r
-}
\ No newline at end of file