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 #20 from mdedetrich/improvedErrorMessaging
Browse files Browse the repository at this point in the history
Improved error messaging when dealing with scopes
  • Loading branch information
raychenon authored Nov 23, 2016
2 parents d082413 + 0394ee3 commit bdeac82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scalariform.formatter.preferences._

val commonSettings = Seq(
organization := "org.zalando",
version := "0.2.1",
version := "0.2.1.1",
scalaVersion := "2.11.8",
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8"),
publishTo := {
Expand Down Expand Up @@ -45,7 +45,7 @@ lazy val playDependencies =
lazy val root = (project in file("."))
.settings(commonSettings: _*)
.settings(name := "play-Zhewbacca")
.settings(version := "0.2.1")
.settings(version := "0.2.1.1")
.settings(libraryDependencies ++= (testDependencies ++ playDependencies))
.settings(parallelExecution in Test := false)

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/org/zalando/zhewbacca/OAuth2AuthProvider.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ class OAuth2AuthProvider @Inject() (getTokenInfo: (OAuth2Token) => Future[Option
private def validateTokenInfo(tokenInfo: TokenInfo, token: OAuth2Token, scope: Scope): AuthResult = {
tokenInfo match {
case TokenInfo(`token`.value, thatScope, `bearerTokenType`, _) if scope.in(thatScope) => AuthTokenValid(tokenInfo)
case _ =>
logger.info(s"Token '${token.toSafeString} has insufficient scope or wrong type.'")
case TokenInfo(_, thatScope, tokenType, _) =>
logger.info(s"Token '${token.toSafeString} has insufficient scope or wrong type, token scopes are ${thatScope.names.mkString(", ")}," +
s"token type is $tokenType")
invalid(token)
}
}
Expand Down

0 comments on commit bdeac82

Please sign in to comment.