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 - name: Create .env file
uses: SpicyPizza/create-envfile@v2 uses: SpicyPizza/create-envfile@v2
with: with:
envkey_DEBUG: true envkey_DEBUG: false
envkey_DB_HOST: "db" envkey_DB_HOST: "db"
envkey_TOKEN: ${{ secrets.TOKEN }} envkey_TOKEN: ${{ secrets.TOKEN }}
envkey_GOOGLE_APPLICATION_CREDENTIALS: "app/wulkanowy-gac.json" 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.auth.oauth2.GoogleCredentials
import com.google.common.collect.Lists import com.google.common.collect.Lists
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
import java.util.logging.Logger
fun decryptToken(tokenString: String, playIntegrity: PlayIntegrity = getPlayIntegrity()): IntegrityVerdictPayload { fun decryptToken(tokenString: String, playIntegrity: PlayIntegrity = getPlayIntegrity()): IntegrityVerdictPayload {
val decodeTokenRequest = DecodeIntegrityTokenRequest().setIntegrityToken(tokenString) val decodeTokenRequest = DecodeIntegrityTokenRequest().setIntegrityToken(tokenString)
@ -17,9 +16,6 @@ fun decryptToken(tokenString: String, playIntegrity: PlayIntegrity = getPlayInte
.execute() .execute()
.toPrettyString() .toPrettyString()
val log = Logger.getLogger("decryptToken")
log.info("Decrypted token: $returnString")
return Json.decodeFromString(returnString) return Json.decodeFromString(returnString)
} }

View file

@ -1,7 +1,5 @@
package io.github.wulkanowy.schools.integrity package io.github.wulkanowy.schools.integrity
import java.util.logging.Logger
// Package name of the client application // Package name of the client application
const val APPLICATION_PACKAGE_IDENTIFIER = "io.github.wulkanowy" 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.request.*
import io.ktor.server.response.* import io.ktor.server.response.*
import io.ktor.server.routing.* import io.ktor.server.routing.*
import java.util.logging.Level
import java.util.logging.Logger
fun Application.configureRouting() { fun Application.configureRouting() {
val loginEventDao = LoginEventDao() val loginEventDao = LoginEventDao()
@ -21,6 +23,7 @@ fun Application.configureRouting() {
when (val result = validateCommand(request.data.uuid, integrityVerdict)) { when (val result = validateCommand(request.data.uuid, integrityVerdict)) {
ValidateResult.VALIDATE_SUCCESS -> { ValidateResult.VALIDATE_SUCCESS -> {
Logger.getLogger("result").log(Level.INFO, "${request.data.uuid}: $result")
loginEventDao.addLoginEvent(request.data) loginEventDao.addLoginEvent(request.data)
call.respond(status = HttpStatusCode.NoContent, "") call.respond(status = HttpStatusCode.NoContent, "")
} }
@ -28,6 +31,7 @@ fun Application.configureRouting() {
ValidateResult.VALIDATE_NONCE_NOT_FOUND, ValidateResult.VALIDATE_NONCE_NOT_FOUND,
ValidateResult.VALIDATE_NONCE_MISMATCH, ValidateResult.VALIDATE_NONCE_MISMATCH,
ValidateResult.VALIDATE_INTEGRITY_FAIL -> { ValidateResult.VALIDATE_INTEGRITY_FAIL -> {
Logger.getLogger("result").log(Level.INFO, "${request.data.uuid}: $result")
call.respond(status = HttpStatusCode.BadRequest, message = result.name) call.respond(status = HttpStatusCode.BadRequest, message = result.name)
} }
} }