             .grouped(middleware)
             .grouped("users")
 
-        users.get("me") { req -> U in
-            return try req.user()
+        users.get("me") { (request: Request) -> Future<U> in
+
+            try request.user().flatMap(to: U.self) { (u: U) in
+                print(u)
+                return try request.user()
+            }
         }
 
         return .done(on: container)
     }
 }
 
+import Fluent
+import Vapor
+
+extension JWTKeychainProvider where U: Model, U.ID == Int, U.Database: QuerySupporting {
+    public convenience init() {
+        self.init { (request, id) -> Future<U> in
+            U.query(on: request).first().map(to: U.self) {
+                guard let user = $0 else {
+                    throw JWTKeychainError.userNotFound
+                }
+                return user
+            }
+        }
+    }
+}
+
 final class UserCache<U>: Service {
-    private let loadUser: (String) throws -> U
+    private let loadUser: UserLoader<U>
 
-    init(loadUser: @escaping (String) throws -> U) {
+    init(loadUser: @escaping UserLoader<U>) {
         self.loadUser = loadUser
     }
 
     var userId: String? = nil
 
-    private var cachedUser: U?
-    func user() throws -> U {
-        if let loadedUser = cachedUser {
-            return loadedUser
+    private var cachedUser: Future<U>?
+    func user(on request: Request) throws -> Future<U> {
+        if let cachedUser = cachedUser {
+            return cachedUser
         } else if let userId = userId {
-            let user = try loadUser(userId)
+            let user = try loadUser(request, userId)
             cachedUser = user
             return user
         } else {


enum JWTKeychainError: Error {
    case unauthorized
}

extension JWTKeychainError: AbortError {


extension JWTSigner: Service {}

public typealias UserLoader<U> = (Request, String) throws -> Future<U>

public final class JWTKeychainProvider<U: Content>: Provider {
    private let userCacheFactory: () -> UserCache<U>

    public init(loadUser: @escaping UserLoader<U>) {
        userCacheFactory = { UserCache<U>(loadUser: loadUser) }
    }

