├── README.md ├── src └── main │ ├── resources │ └── bootstrap.yml │ └── java │ └── org │ └── openpaas │ └── paasta │ └── infraadmin │ ├── InfraAdminApplication.java │ └── config │ └── SecurityConfig.java └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | # PAAS-TA-PORTAL-INFRA-ADMIN 2 | v2.0 - Sprint1 3 | 4 | ## 유의사항 5 | - java 1.8 버전 6 | - SpringCloud Edgware.RELEASE 7 | - TomcatEmded 8.5.14 8 | - Gradle 4.4.1 9 | - Spring-boot 1.5.9 10 | - Redis 1.3.1 -------------------------------------------------------------------------------- /src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: PortalInfraAdmin 4 | cloud: 5 | config: 6 | uri: http://localhost:8004 7 | 8 | server: 9 | port: ${PORT:2227} 10 | 11 | 12 | # Discovery Server Access 13 | eureka: 14 | client: 15 | serviceUrl: 16 | defaultZone: http://127.0.0.1:2221/eureka/ 17 | registry-fetch-interval-seconds: 5 18 | instance: 19 | hostname: ${spring.cloud.client.hostname} 20 | lease-expiration-duration-in-seconds: 5 21 | lease-renewal-interval-in-seconds: 10 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # ignore output and build directories 14 | build/** 15 | bin/** 16 | out/** 17 | .idea/** 18 | 19 | # Package Files # 20 | *.jar 21 | *.war 22 | *.ear 23 | *.zip 24 | *.tar.gz 25 | *.rar 26 | 27 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 28 | hs_err_pid* 29 | 30 | # generated gradle directories and files 31 | .gradle 32 | .settings 33 | 34 | # eclise settings 35 | .classpath 36 | .project 37 | 38 | # remove spring bean configuration 39 | .spring* 40 | 41 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/infraadmin/InfraAdminApplication.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.infraadmin; 2 | 3 | import de.codecentric.boot.admin.config.EnableAdminServer; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * The type Application. 13 | */ 14 | 15 | @EnableAutoConfiguration 16 | @Configuration 17 | @SpringBootApplication 18 | @EnableAdminServer 19 | @EnableDiscoveryClient 20 | public class InfraAdminApplication { 21 | public static void main(String[] args) { 22 | SpringApplication.run(InfraAdminApplication.class, args); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/org/openpaas/paasta/infraadmin/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package org.openpaas.paasta.infraadmin.config; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.security.authentication.AuthenticationManager; 10 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 11 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 12 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 13 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 14 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 15 | 16 | /** 17 | * The type Security config. 18 | */ 19 | @Configuration 20 | @EnableWebSecurity 21 | public class SecurityConfig extends WebSecurityConfigurerAdapter { 22 | 23 | private static final Logger LOGGER = LoggerFactory.getLogger(SecurityConfig.class); 24 | 25 | @Value("${spring.security.username}") 26 | String username; 27 | 28 | @Value("${spring.security.password}") 29 | String password; 30 | 31 | /** 32 | * Configure global. 33 | * 34 | * @throws Exception the exception 35 | */ 36 | 37 | @Bean 38 | public BCryptPasswordEncoder passwordEncoder() { 39 | return new BCryptPasswordEncoder(); 40 | } 41 | 42 | @Autowired 43 | protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { 44 | LOGGER.info("USER : " + username + " PWD : " + password); 45 | auth.inMemoryAuthentication().withUser(username).password(password).roles("USER"); 46 | } 47 | 48 | @Bean 49 | @Override 50 | public AuthenticationManager authenticationManagerBean() throws Exception { 51 | return super.authenticationManagerBean(); 52 | } 53 | 54 | @Override 55 | protected void configure(HttpSecurity http) throws Exception { 56 | http.formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll(); 57 | http.logout().logoutUrl("/logout"); 58 | http.csrf().disable(); 59 | //Spring boot Admin 정보 접근 URL - 시작 60 | http.authorizeRequests() 61 | .antMatchers("/info").permitAll() 62 | .antMatchers("/env").permitAll() 63 | .antMatchers("/metrics").permitAll() 64 | .antMatchers("/trace").permitAll() 65 | .antMatchers("/dump").permitAll() 66 | .antMatchers("/jolokia").permitAll() 67 | .antMatchers("/configprops").permitAll() 68 | .antMatchers("/logfile").permitAll() 69 | .antMatchers("/flyway").permitAll() 70 | .antMatchers("/liquibase").permitAll() 71 | .antMatchers("/heapdump").permitAll() 72 | .antMatchers("/loggers").permitAll() 73 | .antMatchers("/auditevents").permitAll() 74 | .antMatchers("/hystrix.stream").permitAll() 75 | .antMatchers("/docs").permitAll() 76 | .antMatchers("/jmx").permitAll() 77 | .antMatchers("/management/**").permitAll() 78 | .antMatchers("/api/applications/**").permitAll() 79 | .antMatchers("/health/**").permitAll() 80 | .antMatchers("/resources/**").permitAll(); 81 | //Spring boot Admin 정보 접근 URL - 끝 82 | http.authorizeRequests().antMatchers("/login.html", "/**/*.css", "/img/**", "/third-party/**").permitAll(); 83 | http.authorizeRequests().antMatchers("/**").authenticated(); 84 | http.httpBasic(); 85 | } 86 | 87 | } 88 | --------------------------------------------------------------------------------