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

Commit

Permalink
Merge branch 'master' into migrate-to-play-26
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrykrivaltsevich authored Sep 15, 2017
2 parents 7dff3ee + aa15d8a commit 867da5b
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 @@ -26,15 +26,16 @@ abstract case class ValidateTokenRule(
scope: Scope) 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 867da5b

Please sign in to comment.