전체 글52 Spring Security와 JWT package com.softnet.oceanback.config;import com.softnet.oceanback.config.jwt.JwtAuthenticationEntryPoint;import com.softnet.oceanback.config.jwt.JwtSecurityConfig;import com.softnet.oceanback.config.jwt.TokenProvider;import lombok.RequiredArgsConstructor;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.secur.. 2024. 6. 10. Spring Boot 와 Oauth2 구축 github oauth를 활용하여 oauth를 구현해보는 실습을 할 것 이다. Github 및 Spring Security 로 어플리케이션 보안spring-boot-starter-oauth2-client소셜 로그인(github) 을 하려면 Spring Security Oauth 2.0 클라이언트 스타터를 포함해야한다. Github를 인증 provider 로서 앱을 구성하기application을 다음과 같이 등록한다.http://localhost:8080OAuth redirection URI 는 최종 사용자 에이전트가 GitHub에 인증하고 application 승인 페이지에서 액세스 권한을 부여한 후 다시 리디렉션되는 어플리케이션의 경로이다.아래는 기본 리디렉션 URI 템플릿이다.{baseUrl}/log.. 2024. 6. 10. Spring Security Architecture 이해하기 1. HttpRequest 를 보내면 Dispatcher Servlet 에 도착하기전에 filter가 낚아챈다.request의 종류에 따라 BasicAuthenticationFilter, UsernamePasswordAuthenticationFilter 등의 다른 종류의 Authentication Filter가 작동한다. 이 때 AuthenticationFilter에게 올바른 id와 password가 간다면 Authentication 객체를 만든다. 그런다음 UsernamePasswordAuthenticationToken이 만들어진다. 4. Authentication Manager 은 input으로 Authentication object 갖고 인증 완료후에 다시 Authentication object를.. 2024. 6. 10. Open Session in View Open Session in View 패턴은 영속성 컨텍스트의 생존 범위를 HTTP 요청( Request) 범위로 한정하는 방식이다. 기본적으로 웹 애플리케이션에서는 요청 단위로 영속성 컨텍스트를 열고 닫는다. 하지만 이 방식에서는 *뷰 렌더링 과정에서 지연 로딩이 발생하면 예외가 발생할 수 있다. 왜냐하면 요청이 끝나면서 영속성 컨텍스트가 이미 닫혀있기 때문이다.* 뷰 렌더링 과정 : 서버 측에서 HTML 페이지를 생성하는 과정 Open Session in View 패턴은 이러한 문제를 해결하기 위해 등장했다. 이 패턴을 사용하면 영속성 컨텍스트를 뷰 렌더링이 완료될 때까지 유지할 수 있다. 이를 통해 뷰 렌더링 중에도 지연 로딩이 가능해진다. 하지만 이 패턴은 주의해야 할 점이 있다. 동시성 문제:.. 2024. 4. 25. 이전 1 ··· 3 4 5 6 7 8 9 ··· 13 다음