Skip to content

Commit

Permalink
Disable debug, add some logs in validate result response
Browse files Browse the repository at this point in the history
  • Loading branch information
mklkj committed Sep 26, 2023
1 parent 2af9d2f commit da35c25
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -21,13 +23,15 @@ 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, "")
}

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)
}
}
Expand Down

0 comments on commit da35c25

Please sign in to comment.