From 74e32a5693e309425a7643ca9f22b6bda62ae6a2 Mon Sep 17 00:00:00 2001 From: vlad Date: Fri, 24 Mar 2017 19:09:04 -0700 Subject: Auth provider simplification --- src/main/scala/xyz/driver/core/rest.scala | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/main/scala/xyz/driver/core') diff --git a/src/main/scala/xyz/driver/core/rest.scala b/src/main/scala/xyz/driver/core/rest.scala index ebdb1b9..32ac3fa 100644 --- a/src/main/scala/xyz/driver/core/rest.scala +++ b/src/main/scala/xyz/driver/core/rest.scala @@ -80,15 +80,12 @@ object rest { } } - trait AuthProvider[U <: User] { + abstract class AuthProvider[U <: User](val authorization: Authorization, + log: Logger)(implicit execution: ExecutionContext) { import akka.http.scaladsl.server._ import Directives._ - protected implicit val execution: ExecutionContext - protected val authorization: Authorization - protected val log: Logger - /** * Specific implementation on how to extract user from request context, * can either need to do a network call to auth server or extract everything from self-contained token @@ -96,7 +93,7 @@ object rest { * @param context set of request values which can be relevant to authenticate user * @return authenticated user */ - protected def authenticatedUser(context: ServiceRequestContext): OptionT[Future, U] + def authenticatedUser(context: ServiceRequestContext): OptionT[Future, U] def authorize(permissions: Permission*): Directive1[U] = { serviceContext flatMap { ctx => -- cgit v1.2.3