def limitByTier()

in src/main/scala/security/Security.scala [14:26]


  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 {
          protectedCb(tier)
        }
      case None=>
        Forbidden("You must have an API key to access this resource")
    }
  }