feat(ai-character): 관리자 API Phase 1 기반을 추가한다

This commit is contained in:
2026-07-26 05:01:34 +09:00
parent d3564f8c0d
commit 0d2742756f
19 changed files with 4108 additions and 16 deletions
@@ -83,15 +83,21 @@ class TokenProvider(
.parseClaimsJws(token)
.body
val authorities = claims[AUTHORITIES_KEY].toString().split(",").map { SimpleGrantedAuthority(it) }
val memberToken = tokenRepository.findByIdOrNull(id = claims.subject.toLong())
val memberId = claims.subject?.toLongOrNull()
?: throw SodaException(messageKey = "common.error.bad_credentials")
val authorityNames = (claims[AUTHORITIES_KEY] as? String)
?.split(",")
?.takeIf { names -> names.all { it.isNotBlank() } }
?: throw SodaException(messageKey = "common.error.bad_credentials")
val authorities = authorityNames.map { SimpleGrantedAuthority(it) }
val memberToken = tokenRepository.findByIdOrNull(id = memberId)
?: throw SodaException(messageKey = "common.error.bad_credentials")
if (!memberToken.tokenSet.contains(token)) {
throw SodaException(messageKey = "common.error.bad_credentials")
}
val member = repository.findByIdOrNull(id = claims.subject.toLong())
val member = repository.findByIdOrNull(id = memberId)
?: throw SodaException(messageKey = "common.error.bad_credentials")
val principal = MemberAdapter(member)