Disable debug, add some logs in validate result response

This commit is contained in:
Mikołaj Pich 2023-09-26 23:46:50 +02:00
parent 2af9d2f7bd
commit da35c25544
4 changed files with 5 additions and 7 deletions

View file

@ -13,7 +13,7 @@ jobs:
- name: Create .env file
uses: SpicyPizza/create-envfile@v2
with:
envkey_DEBUG: true
envkey_DEBUG: false
envkey_DB_HOST: "db"
envkey_TOKEN: ${{ secrets.TOKEN }}
envkey_GOOGLE_APPLICATION_CREDENTIALS: "app/wulkanowy-gac.json"

View file

@ -8,7 +8,6 @@ import com.google.auth.http.HttpCredentialsAdapter
import com.google.auth.oauth2.GoogleCredentials
import com.google.common.collect.Lists
import kotlinx.serialization.json.Json
import java.util.logging.Logger
fun decryptToken(tokenString: String, playIntegrity: PlayIntegrity = getPlayIntegrity()): IntegrityVerdictPayload {
val decodeTokenRequest = DecodeIntegrityTokenRequest().setIntegrityToken(tokenString)
@ -17,9 +16,6 @@ fun decryptToken(tokenString: String, playIntegrity: PlayIntegrity = getPlayInte
.execute()
.toPrettyString()
val log = Logger.getLogger("decryptToken")
log.info("Decrypted token: $returnString")
return Json.decodeFromString(returnString)
}

View file

@ -1,7 +1,5 @@
package io.github.wulkanowy.schools.integrity
import java.util.logging.Logger
// Package name of the client application
const val APPLICATION_PACKAGE_IDENTIFIER = "io.github.wulkanowy"

View file

@ -8,6 +8,8 @@ import io.ktor.server.application.*
import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
import java.util.logging.Level
import java.util.logging.Logger
fun Application.configureRouting() {
val loginEventDao = LoginEventDao()
@ -21,6 +23,7 @@ fun Application.configureRouting() {
when (val result = validateCommand(request.data.uuid, integrityVerdict)) {
ValidateResult.VALIDATE_SUCCESS -> {
Logger.getLogger("result").log(Level.INFO, "${request.data.uuid}: $result")
loginEventDao.addLoginEvent(request.data)
call.respond(status = HttpStatusCode.NoContent, "")
}
@ -28,6 +31,7 @@ fun Application.configureRouting() {
ValidateResult.VALIDATE_NONCE_NOT_FOUND,
ValidateResult.VALIDATE_NONCE_MISMATCH,
ValidateResult.VALIDATE_INTEGRITY_FAIL -> {
Logger.getLogger("result").log(Level.INFO, "${request.data.uuid}: $result")
call.respond(status = HttpStatusCode.BadRequest, message = result.name)
}
}