Skip to content

Commit

Permalink
hmmmm
Browse files Browse the repository at this point in the history
  • Loading branch information
fredex42 committed Mar 16, 2024
1 parent 3fda8dc commit 5640ae5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/scala/security/Security.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import cats.effect.IO
import com.typesafe.config.Config
import org.http4s.{Request, Response}
import org.http4s.dsl.io._
import org.slf4j.LoggerFactory

import java.util.concurrent.TimeUnit
import scala.concurrent.duration._

class Security(private val auth:ApiKeyAuth) extends Authenticator {
private val logger = LoggerFactory.getLogger(getClass)
def limitByTier(req:Request[IO], minTier:UserTier)(protectedCb: UserTier => IO[Response[IO]]):IO[Response[IO]] = {
auth.extractUserTier(req) match {
case Some(tier)=>
logger.debug(s"User tier is $tier")
if(tier < minTier) {
Forbidden("Currently only internal-tier keys are allowed access")
} else {
Expand Down

0 comments on commit 5640ae5

Please sign in to comment.