java
@GetMapping("") public String qnaList( Authentication authentication,) { if(authentication!=null) { //접속자 권한 정보확인 PrincipalDetails principalDetails = (PrincipalDetails) authentication.getPrincipal(); System.out.println("principalDetails :" + principalDetails.getMember().getRole()); } return null; }
jsp
<sec:authorize access="isAnonymous()"> 로그인 안한 유저 </sec:authorize> <sec:authorize access="isAuthenticated()"> 로그인한 유저 <sec:authorize access="hasRole('ROLE_ADMIN')"> || 관리자 </sec:authorize> </sec:authorize>
댓글 ( 5)
댓글 남기기