update
This commit is contained in:
parent
132e1912f4
commit
41163b312d
|
@ -0,0 +1,4 @@
|
|||
.DS_Store
|
||||
/.build
|
||||
/Packages
|
||||
/*.xcodeproj
|
|
@ -0,0 +1,142 @@
|
|||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "Console",
|
||||
"repositoryURL": "https://github.com/vapor/console.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "038e30ec9004fb1915d14d964a3facc1ec5c80f4",
|
||||
"version": "3.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Core",
|
||||
"repositoryURL": "https://github.com/vapor/core.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "ce64e70a48adf54835d040ba4c4dab431e2cd020",
|
||||
"version": "3.1.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Crypto",
|
||||
"repositoryURL": "https://github.com/vapor/crypto.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "a5598aba7a118c29b224122c16598a1919b9e67d",
|
||||
"version": "3.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "DatabaseKit",
|
||||
"repositoryURL": "https://github.com/vapor/database-kit.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "e594e658cc001e04b8d4ad13881d8714c510f94f",
|
||||
"version": "1.0.0-rc.2.2.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Engine",
|
||||
"repositoryURL": "https://github.com/vapor/engine.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "2419e37d689b78c9197b2f38cd8f2901cd7dcf9e",
|
||||
"version": "3.0.0-rc.2.3.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Multipart",
|
||||
"repositoryURL": "https://github.com/vapor/multipart.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "d7b641af117910e66781022c1c82638216cad62c",
|
||||
"version": "3.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Routing",
|
||||
"repositoryURL": "https://github.com/vapor/routing.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "2fc1d4de22a54848b35ad17b3e7f7816f19ebf90",
|
||||
"version": "3.0.0-rc.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Service",
|
||||
"repositoryURL": "https://github.com/vapor/service.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "281a70b69783891900be31a9e70051b6fe19e146",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-nio",
|
||||
"repositoryURL": "https://github.com/apple/swift-nio.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "3275ff7c9c791a628631c2c51b39fd94346b2492",
|
||||
"version": "1.4.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-nio-ssl",
|
||||
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "ea006b6368dbd9dbfd297deb6ddb3f070b72d043",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-nio-ssl-support",
|
||||
"repositoryURL": "https://github.com/apple/swift-nio-ssl-support.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "c02eec4e0e6d351cd092938cf44195a8e669f555",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-nio-zlib-support",
|
||||
"repositoryURL": "https://github.com/apple/swift-nio-zlib-support.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "37760e9a52030bb9011972c5213c3350fa9d41fd",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "TemplateKit",
|
||||
"repositoryURL": "https://github.com/vapor/template-kit.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "497b987a79291c3743fe4ba6f17eadcdf20c1728",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Validation",
|
||||
"repositoryURL": "https://github.com/vapor/validation.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "ab6c5a352d97c8687b91ed4963aef8e7cfe0795b",
|
||||
"version": "2.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Vapor",
|
||||
"repositoryURL": "https://github.com/vapor/vapor.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "26b5c4032f236cc78e6fd3a51ac6d8aceb5a3a4f",
|
||||
"version": "3.0.0-rc.2.4.1"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// swift-tools-version:4.0
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "VaporRequestStorage",
|
||||
products: [
|
||||
.library(name: "VaporRequestStorage", targets: ["VaporRequestStorage"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0-rc")
|
||||
],
|
||||
targets: [
|
||||
.target(name: "VaporRequestStorage", dependencies: ["Vapor"], path: "Sources"),
|
||||
.testTarget(name: "VaporRequestStorageTests", dependencies: ["VaporRequestStorage"], path: "Tests"),
|
||||
]
|
||||
)
|
|
@ -0,0 +1,13 @@
|
|||
import Vapor
|
||||
|
||||
extension Request {
|
||||
public func get(_ key: String)throws -> Codable? {
|
||||
let storage = try self.privateContainer.make(Storage.self)
|
||||
return storage.cache[key]
|
||||
}
|
||||
|
||||
public func set(_ key: String, to value: Codable)throws {
|
||||
let storage = try self.privateContainer.make(Storage.self)
|
||||
storage.cache[key] = value
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import Service
|
||||
|
||||
public class Storage: Service {
|
||||
public var cache: [String: Codable] = [:]
|
||||
|
||||
public init() {}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import Vapor
|
||||
|
||||
public class Provider: Vapor.Provider {
|
||||
public static var repositoryName: String = "VaporRequestStorage"
|
||||
|
||||
public init () {}
|
||||
|
||||
public func register(_ services: inout Services) throws {
|
||||
services.register() { (container) -> (Storage) in
|
||||
return Storage()
|
||||
}
|
||||
}
|
||||
|
||||
public func boot(_ worker: Container) throws {}
|
||||
|
||||
public func didBoot(_ worker: Container) throws -> EventLoopFuture<Void> { return Future.map(on: worker) {()} }
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
import XCTest
|
||||
@testable import JWT
|
||||
import Bits
|
||||
import Crypto
|
||||
|
||||
class JWTTests: XCTestCase {
|
||||
func testExpired() throws {
|
||||
|
||||
let testRequest = Request(using: container)
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue