Skip to content

Commit 82ea2c8

Browse files
committed
πŸ› Fixed UserUtils πŸ›
1 parent 1d3de5b commit 82ea2c8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

β€Žsrc/main/kotlin/club/anifox/backend/service/keycloak/KeycloakService.ktβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class KeycloakService(
3434

3535
fun findByUserID(id: String): UserRepresentation? =
3636
try {
37+
println("ZXCXZ = $realm")
3738
keycloak
3839
.realm(realm)
3940
.users()

β€Žsrc/main/kotlin/club/anifox/backend/util/user/UserUtils.ktβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ class UserUtils(
1616
) {
1717
fun checkUser(token: String): UserTable {
1818
val keycloakUser = keycloakService.findByUserID(tokenHelper.getTokenInfo(token).sub!!)
19+
1920
return if (keycloakUser != null) {
20-
userRepository.findById(tokenHelper.getTokenInfo(token).preferredUsername!!)
21+
userRepository.findById(tokenHelper.getTokenInfo(token).sub!!)
2122
.orElseThrow { throw NotFoundException("User not found") }
2223
} else {
2324
throw NotFoundException("User not found")

0 commit comments

Comments
Β (0)