update icons

This commit is contained in:
2026-07-26 16:18:15 +03:00
parent d2e00692a6
commit 925a8fc9ca
14 changed files with 67 additions and 87 deletions
@@ -22,7 +22,6 @@ class BackendUpdateFetcherFactory(
}
}
@Factory(binds = [BackendUpdateFetcher::class])
class BackendUpdateFetcher(
private val envFetcher: EnvFetcher,
private val json: Json,
@@ -1,12 +1,11 @@
package ru.shadowsparky.vbox.backend.presentation
import com.auth0.jwt.JWT
import com.auth0.jwt.interfaces.DecodedJWT
import io.ktor.http.HttpStatusCode
import io.ktor.server.application.Application
import io.ktor.server.application.ApplicationCall
import io.ktor.server.application.install
import io.ktor.server.auth.Authentication
import io.ktor.server.auth.authentication
import io.ktor.server.auth.jwt.JWTPrincipal
import io.ktor.server.auth.jwt.jwt
import io.ktor.server.response.respond
@@ -43,7 +42,7 @@ fun Application.configureJwt(authEntryPoint: AuthEntryPoint) {
null
}
}
challenge { defaultScheme, realm ->
challenge { _, _ ->
call.respond(
HttpStatusCode.Unauthorized,
ServerExceptionInfo(INVALID_TOKEN_MSG)
@@ -53,18 +52,10 @@ fun Application.configureJwt(authEntryPoint: AuthEntryPoint) {
}
}
private fun String?.obtainToken(): DecodedJWT {
val token = this?.removePrefix("Bearer ")
?: throw VerifyTokenException(INVALID_TOKEN_MSG)
return JWT.decode(token)
}
fun ApplicationCall.obtainToken(): DecodedJWT {
return request.headers["Authorization"].obtainToken()
}
fun ApplicationCall.obtainUserId(): Long {
return obtainToken()
val principal = authentication.principal<JWTPrincipal>()
?: throw VerifyTokenException(INVALID_TOKEN_MSG)
return principal.payload
.getClaim(USER_ID_ARG)
.asLong()
}