BACKEND/Spring

Secure Coding

Hello? 2018. 3. 5. 16:49

Secure Coding

------------------------------------

1. SQL Injection

2. XSS

3. CSRF


Spring Security

------------------------------------

Authentication : 인증

Authorization : 권한


1. Authentication

(1) Credential 기반 인증 - 아이디, 패스워드를 이용해 인증하는 방식, 

가장 쉽고 널리 사용되는 방식

(2) 이중 인증

(3) 물리 인증


2. Authorization

리소스에 대한 권한 부여 : intercept


DelegatingFilterProxy  -> Spring Security


DelegatingFilterProxy클래스가 클라이언트와 리소스 사이에서 가로채서 Spring Security로 보내서 검증한뒤 리소스 권한을 부여한다.


클라이언트 ---------------> 리소스


3. Security Expressions

hasAddress(ipAddress) : 웹 전용

hasRole(role)

hasAnyRole(role)

----------------------------

permitAll : 모두다 인증

authenticated : 인증받은 것들만 지칭할때

anonymous : 인증받지 못한것들만 지칭할때 

rememberMe : 아이디, 패스워드를 쿠키에 저장해서 인증할때

denyAll : 모두 인증 거부할때


4. 사용자 인증 처리

(1) UserDetails

(2) GrantedAuthority

(3) AutenticationProvider

(4) UsernamePasswordAuthenticationToken

(5) Autentication


5. Database 인증 처리


6. 패스워드 암호화

(1) BCryptPasswordEncoder


7. 중복 로그인 방지


8. RememberMe