Coverage Summary for Class: SecurityKt (dev.suresh.plugins)

Class Method, % Branch, % Line, % Instruction, %
SecurityKt 0% (0/4) 0% (0/7) 0% (0/31)
SecurityKt$configureSecurity$1$1$1 0% (0/1) 0% (0/2) 0% (0/3) 0% (0/11)
SecurityKt$configureSecurity$1$2$1 0% (0/1) 0% (0/4) 0% (0/3) 0% (0/19)
Total 0% (0/6) 0% (0/6) 0% (0/13) 0% (0/61)


 package dev.suresh.plugins
 
 import io.ktor.server.application.*
 import io.ktor.server.auth.*
 
 fun Application.configureSecurity() {
   authentication {
     bearer("auth-bearer") {
       realm = "Ktor App"
       authenticate { tokenCredential ->
         when (tokenCredential.token) {
           "token" -> UserIdPrincipal("admin")
           else -> null
         }
       }
     }
 
     basic("admin") {
       realm = "App Admin"
       validate { credentials ->
         when (credentials.name == "admin" && credentials.password == "admin") {
           true -> UserIdPrincipal(credentials.name)
           else -> null
         }
       }
     }
   }
 }