Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #38 from rgritti/master
Browse files Browse the repository at this point in the history
adding class scope to request logs
  • Loading branch information
dmitrykrivaltsevich authored Sep 15, 2017
2 parents 0a092b6 + f077386 commit aa15d8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/scala/org/zalando/zhewbacca/SecurityRule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ abstract case class ValidateTokenRule(
) extends StrictRule(method, pathRegex) {

def authProvider: AuthProvider
private[this] val log = Logger(this.getClass)

override def execute(nextFilter: (RequestHeader) => Future[Result], requestHeader: RequestHeader)(implicit ec: ExecutionContext): Future[Result] =
RequestValidator.validate(scope, requestHeader, authProvider).flatMap[Result] {
case Right(tokenInfo) =>
Logger.info(s"Request #${requestHeader.id} authenticated as: ${tokenInfo.userUid}")
log.info(s"Request #${requestHeader.id} authenticated as: ${tokenInfo.userUid}")
nextFilter(requestHeader.withTokenInfo(tokenInfo))

case Left(result) =>
Logger.info(s"Request #${requestHeader.id} failed auth")
log.info(s"Request #${requestHeader.id} failed auth")
Future.successful(result)
}
}
Expand Down

0 comments on commit aa15d8a

Please sign in to comment.