스프링
-
AOP(Aspect-Oriented Programming)란? - 스프링 AOP와 프록시스프링 2022. 9. 7. 15:30
안녕하세요! 이번 포스트에서는 AOP의 개념과 스프링의 AOP 방식에 대해서 작성해보겠습니다. AOP란? AOP는 흔히 스프링의 3대 프로그래밍 모델(DI, AOP, PSA) 중 하나로 알려져있으며 Aspect-Oriented Programming 약자입니다. 이걸 그대로 번역하면 관점 지향 프로그래밍입니다. 그럼 관점(Ascpect)란 무엇일까요?! 어플리케이션 코드에서는 로깅, 보안, 트랜잭션 등 비즈니스 로직과는 상관없이 반복적으로 등장하는 부가적은 코드들이 존재합니다. 객체지향적으로 잘 설계된 코드들도 이런 부가적인 코드들을 완벽히 독립시키기에는 부족한 부분이 있었습니다. 이런 부가기능들을 어떻게 모듈화할 것인지 생각해온 사람들은 기존의 전통적인 객체지향 설계 패러다임으로는 한계가 있다고 생각했었..
-
[Spring Security] UsernamePasswordAuthenticationFilter의 내부 동작 과정을 알아보자스프링 2022. 8. 3. 16:19
UsernamePasswordAuthenticationFilter 란? UsernamePasswordAuthenticationFilter는 Form 데이터 기반의 로그인 처리 필터입니다. 설정한 로그인 url로 오는 요청을 감시하며, 로그인 url이 맞다면 그 요청을 필터가 낚아채서 Form 데이터 형식으로 전달받은 username과 password 정보가 실제 유저정보와 일치하는지 확인합니다. 정보가 맞다면 Authentication 객체를 담을 SecurityContext를 생성하고 SecurityContextHolder에 저장합니다. UsernamePasswordAuthenticationFilter 동작과정 1. UsernamePasswordAuthenticationFilter 로그인 URL이 날라..
-
[Spring Security] Security Oauth2 설정에서 custom OAuth2UserService가 실행하지 않는 이슈스프링 2022. 7. 23. 16:20
@Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { return http .oauth2Login() .authorizationEndpoint() .baseUri("/oauth2/authorization") .authorizationRequestRepository(cookieAuthorizationRequestRepository()) .and() .redirectionEndpoint() .baseUri("/*/oauth2/code/*") .and() .userInfoEndpoint() .userService(customOAuth2UserService) .and() .failureHandler(oA..
-
스프링 디스패처 서블릿(DispatcherServlet)의 개념과 동작흐름스프링 2022. 7. 5. 23:55
The DispatcherServlet. 프론트 컨트롤러. 프론트 컨트롤러 패턴은 중앙집중형 컨트롤러를 모든 컨트롤러 제일 앞에 둬서 서버로 들어오는 모든 요청을 먼저 받아서 처리하게 만듭니다. 프론트 컨트롤러는 클라이언트가 보낸 요청을 받아서 공통적인 작업을 먼저 수행한 후에 적절한 세부 컨트롤러로 작업을 위임해주고, 클라이언트에게 보낼 뷰를 선택해서 최종 결과를 생성하는 등의 작업을 합니다. 예외가 발생했을 때 이를 일관된 방식으로 처리하는 것도 프론트 컨트롤러의 역할입니다. 디스패처 서블릿. 스프링 서블릿/MVC의 중앙에 위치한 DispatcherServlet은 모든 연결을 담당하는 프론트 컨트롤러입니다. 웹 브라우저로부터 요청이 들어오면 DispatcherServlet은 그 요청을 제일 앞단에서 ..
-
[Spring] Spring Config Server와 Git Private Repository 연동 방법스프링 2022. 6. 18. 17:50
1. 로컬에 ssh key 생성 ssh-keygen -m PEM -t ecdsa -b 521 -C "your_email@example.com" 터미널 or CMD 창을 열어서 위 명령어를 입력한다. $ ssh-keygen -m PEM -t ecdsa -b 521 -C "your_email@example.com" Generating public/private ecdsa key pair. Enter file in which to save the key (/c/Users/kkh24/.ssh/id_ecdsa): example #키 이름 지정 Enter passphrase (empty for no passphrase): #비밀번호 지정 (그냥 엔터치면 비밀번호 지정안함) Enter same passphrase a..