https://spring.io/guides/gs/securing-web/#scratch
Maven Build 만들기
mkdir -p src/main/java/hello
pom.xml 생성
비보호 WebApplication 생성
src/main/resources/templates/home.html
src/main/resources/templates/hello.html
Classpath에 Spring Security 추가
pom.xml에 아래 추가
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
Security Configuration Java File 생성
src/main/java/hello/WebSecurityConfig.java
WebSecurityConfig의 특징
@EnableWebSecurity -> Web 보안 지원 및 Spring MVC 통합을 가능하게 함.
WebSecurityConfigurerAdapter를 상속 하여 몇 가지 Web 보안 설정을 조정.
configure(HttpSecurity) method는 URL 경로의 보안 관련 상세 설정을 기술.
"/", "/home"은 인증이 요구 되지 않게 설정 함.
configureGlobal(AuthenticationManagerBuilder) method는 메모리에 사용자 추가 설정하는 method이다.
로그인 페이지 만들기
src/main/resources/templates/login.html
어플리케이션 실행하기
mvn spring-boot:run
실행 가능 jar 만들기.
mvn clean package
'기타-프로그래밍' 카테고리의 다른 글
MADP EMM 개념 정리 (0) | 2018.01.25 |
---|---|
Mobile Acronym 모바일 두문자어 (0) | 2018.01.22 |
GCP Putty 연결하기 (0) | 2018.01.19 |
Spring Boot 시작하기 (0) | 2018.01.15 |
NoSuchElementException (0) | 2008.03.03 |