diff --git a/src/main/kotlin/com/example/v1oauthauthorizationservice/infrastructure/oauth2/presentation/OAuthController.kt b/src/main/kotlin/com/example/v1oauthauthorizationservice/infrastructure/oauth2/presentation/OAuthController.kt index 8dc0f03..42207c0 100644 --- a/src/main/kotlin/com/example/v1oauthauthorizationservice/infrastructure/oauth2/presentation/OAuthController.kt +++ b/src/main/kotlin/com/example/v1oauthauthorizationservice/infrastructure/oauth2/presentation/OAuthController.kt @@ -7,15 +7,12 @@ import com.example.v1oauthauthorizationservice.infrastructure.oauth2.presentatio import com.example.v1oauthauthorizationservice.infrastructure.oauth2.presentation.dto.response.RegenerateSecretResponse import com.example.v1oauthauthorizationservice.infrastructure.oauth2.presentation.dto.response.RegisterClientResponse import com.example.v1oauthauthorizationservice.infrastructure.oauth2.presentation.dto.response.UpdateClientResponse -import com.example.v1oauthauthorizationservice.infrastructure.user.repository.dtos.UserInformationDto -import com.example.v1oauthauthorizationservice.infrastructure.user.security.AuthDetailsService import org.springframework.web.bind.annotation.* @RestController @RequestMapping("/oauth2") class OAuthController( - private val OAuthApi: OAuthApi, - private val authDetailsService: AuthDetailsService + private val OAuthApi: OAuthApi ) { @GetMapping("/client") @@ -37,9 +34,4 @@ class OAuthController( fun regenerateSecret(@PathVariable("client-id") clientId: String): RegenerateSecretResponse { return OAuthApi.regenerateSecret(clientId) } - - @GetMapping("/userinfo/{account-id}") - fun getUserInfo(@PathVariable("account-id") accountId: String): UserInformationDto { - return authDetailsService.getUserInformation(accountId) - } } diff --git a/src/main/kotlin/com/example/v1oauthauthorizationservice/infrastructure/user/security/AuthDetailsService.kt b/src/main/kotlin/com/example/v1oauthauthorizationservice/infrastructure/user/security/AuthDetailsService.kt deleted file mode 100644 index 4ba08ee..0000000 --- a/src/main/kotlin/com/example/v1oauthauthorizationservice/infrastructure/user/security/AuthDetailsService.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.example.v1oauthauthorizationservice.infrastructure.user.security - -import com.example.v1oauthauthorizationservice.infrastructure.user.exceptions.UserNotFoundException -import com.example.v1oauthauthorizationservice.infrastructure.user.repository.UserInformationRepository -import org.springframework.security.core.GrantedAuthority -import org.springframework.security.core.authority.SimpleGrantedAuthority -import org.springframework.security.core.userdetails.User -import org.springframework.security.core.userdetails.UserDetails -import org.springframework.security.core.userdetails.UserDetailsService -import org.springframework.stereotype.Service -import kotlin.jvm.Throws - -@Service -class AuthDetailsService( - private val userInformationRepository: UserInformationRepository -): UserDetailsService { - @Throws(UserNotFoundException::class) - override fun loadUserByUsername(username: String): UserDetails { - val user = userInformationRepository.findUserByAccountId(username) - user ?: throw UserNotFoundException(username) - - val authorities: Collection = listOf( - SimpleGrantedAuthority("ROLE_" + user.userRole.toString()) - ) - - return User(user.accountId, user.password, authorities) - } -} \ No newline at end of file