diff --git a/maeumgagym-infrastructure/src/main/kotlin/com/info/maeumgagym/security/principle/CustomUserDetailService.kt b/maeumgagym-infrastructure/src/main/kotlin/com/info/maeumgagym/security/principle/CustomUserDetailService.kt deleted file mode 100644 index bd3cc4bdf..000000000 --- a/maeumgagym-infrastructure/src/main/kotlin/com/info/maeumgagym/security/principle/CustomUserDetailService.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.info.maeumgagym.security.principle - -import org.springframework.security.core.userdetails.UserDetailsService -import org.springframework.stereotype.Component - -@Component -class CustomUserDetailService : UserDetailsService { - - // 유저를 DB에서 불러와 UserDetails를 반환하는 함수 - override fun loadUserByUsername(username: String): CustomUserDetails { - // CustomUserDetails에 User를 null로 삽입해 반환 - return CustomUserDetails(null, username) - } -} diff --git a/maeumgagym-infrastructure/src/main/kotlin/com/info/maeumgagym/security/principle/CustomUserDetails.kt b/maeumgagym-infrastructure/src/main/kotlin/com/info/maeumgagym/security/principle/CustomUserDetails.kt deleted file mode 100644 index 5db56ef0f..000000000 --- a/maeumgagym-infrastructure/src/main/kotlin/com/info/maeumgagym/security/principle/CustomUserDetails.kt +++ /dev/null @@ -1,37 +0,0 @@ -package com.info.maeumgagym.security.principle - -import com.info.maeumgagym.user.model.User -import org.springframework.security.core.GrantedAuthority -import org.springframework.security.core.authority.SimpleGrantedAuthority -import org.springframework.security.core.userdetails.UserDetails - -class CustomUserDetails( - private var user: User?, - private val oauthId: String -) : UserDetails { - - fun getUser(): User? = user - - fun fillUser(user: User) { - if (this.user == null) { - this.user = user - } - } - - override fun getAuthorities(): MutableCollection = - user?.roles?.map { - SimpleGrantedAuthority(it.name) - }?.toMutableList() ?: mutableListOf() - - override fun getPassword(): String? = null - - override fun getUsername(): String = oauthId - - override fun isAccountNonExpired(): Boolean = true - - override fun isAccountNonLocked(): Boolean = true - - override fun isCredentialsNonExpired(): Boolean = true - - override fun isEnabled(): Boolean = true -}