aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/core/AuthTest.scala
diff options
context:
space:
mode:
authorZach Smith <zach@driver.xyz>2017-05-03 18:16:38 -0700
committerZach Smith <zach@driver.xyz>2017-05-24 13:50:04 -0700
commit4f11172ee721f7af12f4ff39cfa96a698fc88342 (patch)
tree4bfb021c1a2efd1ca56c3a9e53aa91d32d04d4d9 /src/test/scala/xyz/driver/core/AuthTest.scala
parente6858db64f9a1c0121aed972cf7426a746eb7175 (diff)
downloaddriver-core-4f11172ee721f7af12f4ff39cfa96a698fc88342.tar.gz
driver-core-4f11172ee721f7af12f4ff39cfa96a698fc88342.tar.bz2
driver-core-4f11172ee721f7af12f4ff39cfa96a698fc88342.zip
Override hashCode equals and toString, rename to AuthorizedRequestContext
Diffstat (limited to 'src/test/scala/xyz/driver/core/AuthTest.scala')
-rw-r--r--src/test/scala/xyz/driver/core/AuthTest.scala15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/test/scala/xyz/driver/core/AuthTest.scala b/src/test/scala/xyz/driver/core/AuthTest.scala
index 441b9c8..9c86577 100644
--- a/src/test/scala/xyz/driver/core/AuthTest.scala
+++ b/src/test/scala/xyz/driver/core/AuthTest.scala
@@ -10,7 +10,7 @@ import org.scalatest.{FlatSpec, Matchers}
import pdi.jwt.{Jwt, JwtAlgorithm}
import xyz.driver.core.auth._
import xyz.driver.core.logging._
-import xyz.driver.core.rest.{AuthProvider, AuthenticatedRequestContext, Authorization, RequestContext}
+import xyz.driver.core.rest.{AuthProvider, AuthorizedRequestContext, Authorization, RequestContext}
import scala.concurrent.Future
import scalaz.OptionT
@@ -36,7 +36,7 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
val authorization: Authorization[User] = new Authorization[User] {
override def userHasPermissions(permissions: Seq[Permission])(
- implicit ctx: AuthenticatedRequestContext[User]): OptionT[Future,
+ implicit ctx: AuthorizedRequestContext[User]): OptionT[Future,
(Map[Permission, Boolean], PermissionsToken)] = {
val permissionsMap = permissions.map(p => p -> (p === TestRoleAllowedPermission)).toMap
val token = PermissionsToken("TODO")
@@ -107,11 +107,12 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo
it should "authorize permission found in permissions token" in {
import spray.json._
- val claim = JsObject(Map(
- "iss" -> JsString("users"),
- "sub" -> JsString("1"),
- "permissions" -> JsObject(Map(TestRoleAllowedByTokenPermission.toString -> JsBoolean(true)))
- )).prettyPrint
+ val claim = JsObject(
+ Map(
+ "iss" -> JsString("users"),
+ "sub" -> JsString("1"),
+ "permissions" -> JsObject(Map(TestRoleAllowedByTokenPermission.toString -> JsBoolean(true)))
+ )).prettyPrint
val permissionsToken = PermissionsToken(Jwt.encode(claim, privateKey, JwtAlgorithm.RS256))
val referenceAuthToken = AuthToken("I am token")