Spring (1) 썸네일형 리스트형 Spring AOP를 활용한 권한 체크 Controller 단에서 권한 체크를 한다면 보통 아래와 같이 if문으로 체크를 할 것 입니다. 여러 곳에서 이러한 if문으로 계속 처리하다보면 중복이 많아지는 문제가 발생해 aop를 활용해 어노테이션으로 처리하는 방법을 알아보도록하겠습니다. @GetMapping public String example(@AuthenticationPrincipal UserPrincipal account){ Grade grade = account.getGrade(); if(grade != Grade.HEAD){ throw new UnauthorizedException(); } return ""; } aop dependency는 spring-boot-starter를 dependency햇다면 안에 내장되어 있습니다. 사용할 .. 이전 1 다음