Skip to content

권한 설정

  1. 스프링 시큐리티 권한 설정을 사용하지 않고 독자적인 권한 로직을 사용한다.
  2. 시큐리티 권한 설정에서 모든 경로에 대해 접근 권한을 허용하도록 설정한다.
    SecurityConfig.kt
    @Bean
    fun filterChain(http: HttpSecurity): SecurityFilterChain {
    http {
    csrf {
    disable()
    }
    formLogin {
    disable()
    }
    cors {
    disable()
    }
    httpBasic {
    disable()
    }
    authorizeHttpRequests {
    authorize(anyRequest, permitAll)
    }
    sessionManagement {
    sessionCreationPolicy = SessionCreationPolicy.IF_REQUIRED
    }
    }
    return http.build()
    }
  3. API 의 경우에는 인터셉터에서 API 요청이 들어올때마다 실행 권한을 확인하여 권한이 없는 경우에 UNAUTHORIZED 응답코드를 반환한다.
  4. 메뉴의 경우에는 메뉴 조회 API에서 로그인 사용자에 대해 조회(쓰기)권한이 있는 메뉴를 반환하도록 구성한다.
  1. 설정
  1. 설정