aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/common/auth
diff options
context:
space:
mode:
authorvlad <vlad@driver.xyz>2017-06-13 16:12:20 -0700
committervlad <vlad@driver.xyz>2017-06-13 16:12:20 -0700
commitcd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c (patch)
tree062e8dad1a1513e26b0fd08b1742d6ff2ee874f7 /src/main/scala/xyz/driver/common/auth
parent0000a65ab4479a2a40e2d6468036438e9705b4aa (diff)
downloadrest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.tar.gz
rest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.tar.bz2
rest-query-cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c.zip
Adding domain entitiesv0.1.0
Diffstat (limited to 'src/main/scala/xyz/driver/common/auth')
-rw-r--r--src/main/scala/xyz/driver/common/auth/AnonymousRequestContext.scala12
-rw-r--r--src/main/scala/xyz/driver/common/auth/AuthenticatedRequestContext.scala32
-rw-r--r--src/main/scala/xyz/driver/common/auth/RequestId.scala15
3 files changed, 0 insertions, 59 deletions
diff --git a/src/main/scala/xyz/driver/common/auth/AnonymousRequestContext.scala b/src/main/scala/xyz/driver/common/auth/AnonymousRequestContext.scala
deleted file mode 100644
index 2e4b55c..0000000
--- a/src/main/scala/xyz/driver/common/auth/AnonymousRequestContext.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-package xyz.driver.common.auth
-
-class AnonymousRequestContext(val requestId: RequestId) {
-
- override def equals(that: Any): Boolean = {
- that.getClass == classOf[AnonymousRequestContext] &&
- that.asInstanceOf[AnonymousRequestContext].requestId == requestId
- }
-
- override def hashCode(): Int = requestId.hashCode()
-
-}
diff --git a/src/main/scala/xyz/driver/common/auth/AuthenticatedRequestContext.scala b/src/main/scala/xyz/driver/common/auth/AuthenticatedRequestContext.scala
deleted file mode 100644
index b211e12..0000000
--- a/src/main/scala/xyz/driver/common/auth/AuthenticatedRequestContext.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-package xyz.driver.common.auth
-
-import xyz.driver.common.logging._
-import xyz.driver.common.domain.User
-
-class AuthenticatedRequestContext(val executor: User,
- override val requestId: RequestId) extends AnonymousRequestContext(requestId) {
-
- override def equals(that: Any): Boolean = {
- that.getClass == this.getClass && {
- val another = that.asInstanceOf[AuthenticatedRequestContext]
- another.executor == executor && another.requestId == requestId
- }
- }
-
- override def hashCode(): Int = {
- val initial = 37
- val first = initial * 17 + executor.hashCode()
- first * 17 + requestId.hashCode()
- }
-
-}
-
-object AuthenticatedRequestContext {
-
- def apply(executor: User) = new AuthenticatedRequestContext(executor, RequestId())
-
- implicit def toPhiString(x: AuthenticatedRequestContext): PhiString = {
- phi"AuthenticatedRequestContext(executor=${x.executor}, requestId=${x.requestId})"
- }
-
-}
diff --git a/src/main/scala/xyz/driver/common/auth/RequestId.scala b/src/main/scala/xyz/driver/common/auth/RequestId.scala
deleted file mode 100644
index 771145c..0000000
--- a/src/main/scala/xyz/driver/common/auth/RequestId.scala
+++ /dev/null
@@ -1,15 +0,0 @@
-package xyz.driver.common.auth
-
-import xyz.driver.common.logging._
-import xyz.driver.common.auth.RequestId._
-import xyz.driver.common.utils.RandomUtils
-
-final case class RequestId(value: String = RandomUtils.randomString(IdLength))
-
-object RequestId {
-
- private val IdLength = 20
-
- implicit def toPhiString(x: RequestId): PhiString = phi"RequestId(${Unsafe(x.value)})"
-
-}