diff options
author | Vlad Uspensky <v.uspenskiy@icloud.com> | 2017-03-25 14:03:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-25 14:03:21 -0700 |
commit | 27ba1f6dc2d58e6e1d33d5b9d1b5b677c451b841 (patch) | |
tree | 366f136662d3e33a58017d740667f55ede59b4ae /src/test/scala/xyz/driver | |
parent | d0ed6d305676fa4cc764d3e2c64341158c298a63 (diff) | |
parent | e74e0229b85a2cb85b31c1f9389dada65ec08b7d (diff) | |
download | driver-core-0.10.34.tar.gz driver-core-0.10.34.tar.bz2 driver-core-0.10.34.zip |
Merge pull request #28 from drivergroup/PDW-238v0.10.34
PDW-238 Session validity verification support for `AuthProvider`
Diffstat (limited to 'src/test/scala/xyz/driver')
-rw-r--r-- | src/test/scala/xyz/driver/core/AuthTest.scala | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/test/scala/xyz/driver/core/AuthTest.scala b/src/test/scala/xyz/driver/core/AuthTest.scala index c39d9da..d1a37a2 100644 --- a/src/test/scala/xyz/driver/core/AuthTest.scala +++ b/src/test/scala/xyz/driver/core/AuthTest.scala @@ -31,13 +31,18 @@ class AuthTest extends FlatSpec with Matchers with MockitoSugar with ScalatestRo } val authStatusService = new AuthProvider[User](authorization, NoLogger) { - override def authenticatedUser(context: ServiceRequestContext): OptionT[Future, User] = OptionT.optionT[Future] { - if (context.contextHeaders.keySet.contains(AuthProvider.AuthenticationTokenHeader)) { - Future.successful(Some(BasicUser(Id[User]("1"), Set(TestRole)))) - } else { - Future.successful(Option.empty[User]) + + override def isSessionValid(user: User)(implicit ctx: ServiceRequestContext): Future[Boolean] = + Future.successful(true) + + override def authenticatedUser(implicit ctx: ServiceRequestContext): OptionT[Future, User] = + OptionT.optionT[Future] { + if (ctx.contextHeaders.keySet.contains(AuthProvider.AuthenticationTokenHeader)) { + Future.successful(Some(BasicUser(Id[User]("1"), Set(TestRole)))) + } else { + Future.successful(Option.empty[User]) + } } - } } import authStatusService._ |