마르코의 개발 일기

고정 헤더 영역

글 제목

메뉴 레이어

마르코의 개발 일기

메뉴 리스트

  • 홈
  • 태그
  • 방명록
  • 분류 전체보기 (88)
    • JAVA (5)
    • Spring (9)
    • SpringSecurity (20)
    • 알고리즘 (1)
    • Database (10)
    • AWS (5)
    • 공학지식 (1)
    • SpringBatch (6)
    • SpringCloud (10)
    • Proxy (2)
    • Linux (1)
    • Node (2)
    • 보안 (3)
    • 암호화 (5)
    • 소켓 (1)
    • 프로젝트 일기 (4)

검색 레이어

마르코의 개발 일기

검색 영역

컨텐츠 검색

SpringSecurity

  • SpringSecurity [AccessDecisionManager]

    2022.07.04 by 성찬우

  • SpringSecurity [DelegatingFliterProxy]

    2022.06.30 by 성찬우

  • SpringSecurity [FilterChainProxy]

    2022.06.29 by 성찬우

  • SpringSecurity [ContextHolder][Authentication]저장 경로

    2022.06.27 by 성찬우

  • SpringBoot + Security [ThreadLocal]

    2022.06.25 by 성찬우

  • SpringSecurity [AuthenticationManager]

    2022.06.24 by 성찬우

  • SpringSecurity [SecurityContextHolder]

    2022.06.24 by 성찬우

  • SpringSecurity [HttpSecurity] 접근 권한 [TestCode]

    2022.06.24 by 성찬우

SpringSecurity [AccessDecisionManager]

우리는 보통 스프링 시큐리티를 사용할때 인증부터 시작한다. 인증을 해야 인가를 하든말든 선택을 할 수 있기 때문이다. 인가는 " 허용할 것인가 ? " 라고 생각하면 될 것이다. 웹 요청 , 메서드콜 등 서버로 요청을 보낼때. "이것을 허용할 것인가?" 의 역할이다. 이때 이 부분 "이것을 허용할 것인가?"를 담당하는 인터페이스가 오늘의 주제 AccessDecisionManager 이다. 이 Manager 익숙하다 .. AuthenticationManager 과 유사한데 이것은 Authentication객체를 만들어 '인증'을 하는데 사용되는 것이고 AccessDecisionManager 는 '인가' 이다. AccassDecisionManager 를 공부하는데 가장 핵심은 Voter 다. Voter를 여러..

SpringSecurity 2022. 7. 4. 22:18

SpringSecurity [DelegatingFliterProxy]

우리가 어떤 요청을 보내면 서블릿 컨테이너(톰캣)가 받는다. 서블릿 컨테이너에서는 서블릿 스팩을 지원하는데 필터라는 개념이 존재한다. 어떤 요청을 처리할 때 앞뒤로 특정한 일을 수행한다. 스프링에도 이런 서블릿 필터 구현체가 존재하는데 그 중하나가 DelegationFliterProxy 이다. (모든 필터가 서블릿필터 구현체라고 생각하면 된다고 한다. 하지만 DelegationFliterProxy 은 직접적으로 서블릿필터에 영향을 준다.) Delegation 는 위임 - 선언 정도의 의미를 가지고있는데 정말 말그대로 filter로서의 역할이 아닌 누군가에게 위임을 하는 역할을 한다. 팀장님같은 존재다. 언제 위임? 서블릿 필터 처리를 스프링에 존재하는 빈으로 위임할 때. (어떤 빈을 사용할지 구체적인 명..

SpringSecurity 2022. 6. 30. 23:29

SpringSecurity [FilterChainProxy]

FilterChainProxy의 전체 코드 >> 더보기 public class FilterChainProxy extends GenericFilterBean { private static final Log logger = LogFactory.getLog(FilterChainProxy.class); private static final String FILTER_APPLIED = FilterChainProxy.class.getName().concat(".APPLIED"); private List filterChains; private FilterChainValidator filterChainValidator = new NullFilterChainValidator(); private HttpFirewall fi..

SpringSecurity 2022. 6. 29. 02:56

SpringSecurity [ContextHolder][Authentication]저장 경로

보호되어 있는 글입니다.

보호글 2022. 6. 27. 01:17

SpringBoot + Security [ThreadLocal]

만약 SecurityContextHolder에 대해 읽어보시지 않은 분은 꼭 읽어봐주세요! https://fitchan.tistory.com/19 java.lang 패키지에서 제공하는 기능입니다. 우리는 많이 사용을 하고 있지만 직접적으로 건드리지 않으므로 잘 모를 수 있다. 개발을 하다보면 각자의 스타일에 따라 패키지를 구분하고 적절한 의존성을 주입한다. 예를 들어 Entity , DTO, Repository, Service, Controller 로 구분한다고 했을 때 A_Contoroller에 A_Service 클래스를 주입하고 A_Service 의 사용 범위는 A_Contoroller이다 또한 메서드 파라미터는 메서드 안에서만 접근이 가능하며 사용범위는 메서드 라고 할 수 있다. ThreadLoca..

SpringSecurity 2022. 6. 25. 21:02

SpringSecurity [AuthenticationManager]

Authentication 을 만들고 인증을 처리하는 인터페이스 AuthenticationManager에 대해서 알아 보겠다. 잠시 확인을 하자면 ContextHolder 는 Authentication 의 정보를 담고있는 것이고. AuthenticationManager는 실제 인증을 담당한다. 인증 하는 동안 무슨일이 일어나는지 알아보겠다. AuthenticationManager는 authenticate 라는 메서드 하나를 갖는다. 매우 조촐한데 Authentication 객체를 파라미터를 받고있으며 이 객체는 정보를 담고 있다. (user가 보낸 username, password등 ) public interface AuthenticationManager { Authentication authentica..

SpringSecurity 2022. 6. 24. 22:23

SpringSecurity [SecurityContextHolder]

시큐리티의 메인이라고 할 수 있는 SecurityContextHolder이다. 1. 시큐리티에서 인증된 내용들을 가지고있으며, 2. [SecurityContext] 를 포함하고 있고 3. SecurityContext 를 현재 스레드와 연결해 주는 역할을 한다. (ThreadLocal 사용) SecurityContextHolder가 시큐리티에서 인증된 내용들을 가지고있다 라는 것을 알았으니 우리는 SecurityContextHolder 를 통해서 유저의 정보를 확인 할 수 있다. 기본적으로 다음과 같다. Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); SecurityContextHolder에는 인증..

SpringSecurity 2022. 6. 24. 21:04

SpringSecurity [HttpSecurity] 접근 권한 [TestCode]

의존성 security-test security 관련 어노테이션 import org.junit.Test; //1 @Test @WithMockUser(username = "userforTest", roles = "USER") //2 @Test @WithMockUser(username = "adminforTest", roles = "ADMIN") //3 @Test @WithAnonymousUser 우리는 SpringSecurity 를 사용 할 때. 유저의 로그인이 필요한 페이지 인지 아닌지 구분하여 유저 인증에 따른 페이지 인가를 내어 줄수 있다. @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.au..

SpringSecurity 2022. 6. 24. 00:04

추가 정보

인기글

최신글

페이징

이전
1 2 3
다음
TISTORY
마르코의 개발 일기 © Magazine Lab
페이스북 트위터 인스타그램 유투브 메일

티스토리툴바