diff --git a/src/main/kotlin/be/vandeas/logic/impl/AuthLogicImpl.kt b/src/main/kotlin/be/vandeas/logic/impl/AuthLogicImpl.kt index 51f660f..4d0238c 100644 --- a/src/main/kotlin/be/vandeas/logic/impl/AuthLogicImpl.kt +++ b/src/main/kotlin/be/vandeas/logic/impl/AuthLogicImpl.kt @@ -42,9 +42,10 @@ class AuthLogicImpl( override fun guard(token: String, path: Path, protectedMethod: () -> T): T = validateOneTimeToken(token, path).let { protectedMethod() } - override fun guard(jwt: String, protectedMethod: () -> T): T { - TODO("Not yet implemented") - } + override fun guard(jwt: String, protectedMethod: () -> T): T = + validateJwtToken(jwt).let { + protectedMethod() + } override fun getJwtToken(apiKey: String, duration: Duration): String { if (!validateApiKey(apiKey)) { diff --git a/src/test/kotlin/be/vandeas/v2/ApplicationTest.kt b/src/test/kotlin/be/vandeas/v2/ApplicationTest.kt index a0325f3..81adb84 100644 --- a/src/test/kotlin/be/vandeas/v2/ApplicationTest.kt +++ b/src/test/kotlin/be/vandeas/v2/ApplicationTest.kt @@ -14,6 +14,7 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.runBlocking import java.util.* import kotlin.io.path.toPath +import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals import kotlin.time.Duration @@ -38,6 +39,11 @@ class ApplicationTest { }.body>()["token"] } + @BeforeTest + fun setup() { + // DELETE ALL FILES FROM SCRATCH + } + @Test fun `Should be able to write and read`() { runBlocking {