SpringSecurity
·
개발/Spring+JPA
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();authentication에서 나올 수 있는 결과물1. getName() • 설명: 인증된 사용자의 이름을 반환합니다. 일반적으로는 사용자의 username이 반환되며, 사용자명은 인증 절차에서 사용되는 고유한 식별자입니다. • 예시: authentication.getName() • 반환 값: String 2. getPrincipal() • 설명: Principal은 인증된 사용자 자체에 대한 정보를 나타냅니다. 실제로는 사용자 객체나 사용자 이름을 포함할 수 있습니다. 인증 방식에 따라 반환되는 객체가 다를 수 있습니다. 예를 들어, UserDe..