@@ -31,11 +129,25 @@
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+
+
org.springframework.boot
spring-boot-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.22.2
+
-
-
+
\ No newline at end of file
diff --git a/src/main/java/com/kdt/yun/configures/WebMvcConfigure.java b/src/main/java/com/kdt/yun/configures/WebMvcConfigure.java
new file mode 100644
index 0000000..e2bfc00
--- /dev/null
+++ b/src/main/java/com/kdt/yun/configures/WebMvcConfigure.java
@@ -0,0 +1,19 @@
+package com.kdt.yun.configures;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * Created by yunyun on 2021/11/11.
+ */
+
+@Configuration
+public class WebMvcConfigure implements WebMvcConfigurer {
+
+ @Override
+ public void addViewControllers(ViewControllerRegistry registry){
+ registry.addViewController("/").setViewName("index");
+ registry.addViewController("/me").setViewName("me");
+ }
+}
diff --git a/src/main/java/com/kdt/yun/configures/WebSecurityConfigure.java b/src/main/java/com/kdt/yun/configures/WebSecurityConfigure.java
new file mode 100644
index 0000000..3bff956
--- /dev/null
+++ b/src/main/java/com/kdt/yun/configures/WebSecurityConfigure.java
@@ -0,0 +1,72 @@
+package com.kdt.yun.configures;
+
+import org.apache.commons.io.file.NoopPathVisitor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.password.NoOpPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+
+/**
+ * Created by yunyun on 2021/11/11.
+ */
+
+@Configuration
+@EnableWebSecurity
+public class WebSecurityConfigure extends WebSecurityConfigurerAdapter {
+
+ @Override
+ public void configure(AuthenticationManagerBuilder auth) throws Exception {
+ //super.configure(auth);
+ auth.inMemoryAuthentication()
+ .withUser("user")
+ .password("{noop}user123")
+ .roles("USER");
+ auth.inMemoryAuthentication()
+ .withUser("admin")
+ .password("{noop}admin123")
+ .roles("ADMIN");
+ }
+
+ @Override
+ public void configure(WebSecurity web){
+ web.ignoring().antMatchers("/assets/**");
+ }
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception{
+ http
+ .authorizeRequests()
+ .antMatchers("/me").hasAnyRole("USER","ADMIN")
+ .anyRequest().permitAll()
+ .and()
+ .formLogin()
+ .defaultSuccessUrl("/")
+ .permitAll()
+ .and()
+ .rememberMe()
+ .rememberMeParameter("remember-me")
+ .tokenValiditySeconds(5 * 60)
+ //.alwaysRemember(true)
+ .and()
+ .logout()
+ //.logoutUrl("/logout")
+ //.deleteCookies("JSESSIONID", "remember-me")
+ .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
+ .logoutSuccessUrl("/")
+ .invalidateHttpSession(true) // 기본 값이 true 이다.
+ .clearAuthentication(true); // 기본 값이 true 이다.
+ }
+
+// @Bean
+// public PasswordEncoder passwordEncoder(){
+// return NoOpPasswordEncoder.getInstance();
+// }
+
+
+}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
deleted file mode 100644
index 8b13789..0000000
--- a/src/main/resources/application.properties
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
new file mode 100644
index 0000000..44f784e
--- /dev/null
+++ b/src/main/resources/application.yml
@@ -0,0 +1,16 @@
+spring:
+ application:
+ name: spring security 01
+ thymeleaf:
+ cache: true
+ security:
+ user:
+ name: user
+ password: user123
+ roles: USER
+ messages:
+ basename: i18n/messages
+ encoding: UTF-8
+ cache-duration: PT1H
+server:
+ port: 8080
\ No newline at end of file
diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt
new file mode 100644
index 0000000..08b4d8a
--- /dev/null
+++ b/src/main/resources/banner.txt
@@ -0,0 +1,7 @@
+ ###### ######## ###### ## ## ######## #### ######## ## ## ## ## ### ###### ######## ######## ########
+## ## ## ## ## ## ## ## ## ## ## ## ## ### ### ## ## ## ## ## ## ## ##
+## ## ## ## ## ## ## ## ## #### #### #### ## ## ## ## ## ## ##
+ ###### ###### ## ## ## ######## ## ## ## ## ### ## ## ## ###### ## ###### ########
+ ## ## ## ## ## ## ## ## ## ## ## ## ######### ## ## ## ## ##
+## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
+ ###### ######## ###### ####### ## ## #### ## ## ####### ## ## ## ## ###### ## ######## ## ##
\ No newline at end of file
diff --git a/src/main/resources/lobback.xml b/src/main/resources/lobback.xml
new file mode 100644
index 0000000..c55cd77
--- /dev/null
+++ b/src/main/resources/lobback.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/static/assets/icons/favi.png b/src/main/resources/static/assets/icons/favi.png
new file mode 100644
index 0000000..3b48c65
Binary files /dev/null and b/src/main/resources/static/assets/icons/favi.png differ
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
new file mode 100644
index 0000000..384805e
--- /dev/null
+++ b/src/main/resources/templates/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+index page
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/me.html b/src/main/resources/templates/me.html
new file mode 100644
index 0000000..95a0b99
--- /dev/null
+++ b/src/main/resources/templates/me.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+내 정보
+
+ 님 반갑습니다.
+
+ User has role ROLE_ADMIN.
+
+
+ User has role ROLE_USER.
+
+
+
+
+
\ No newline at end of file