Skip to content

Commit 074f3c2

Browse files
authored
Merge pull request #8 from marius-se/vapor-4
Migrate to Vapor 4
2 parents 1348859 + e6e9352 commit 074f3c2

68 files changed

Lines changed: 3657 additions & 3387 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
2-
# Created by https://www.gitignore.io/api/vapor
3-
4-
### Vapor ###
5-
Config/secrets
6-
7-
### Vapor Patch ###
81
Packages
92
.build
103
xcuserdata
114
*.xcodeproj
125
DerivedData/
136
.DS_Store
14-
Package.pins
15-
Package.resolved
7+
db.sqlite
8+
.swiftpm
169

17-
# End of https://www.gitignore.io/api/vapor

Package.resolved

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1+
// swift-tools-version:5.6
12
import PackageDescription
23

34
let package = Package(
4-
name: "VaporOAuth",
5+
name: "vapor-oauth",
6+
platforms: [
7+
.macOS(.v12)
8+
],
9+
products: [
10+
.library(
11+
name: "OAuth",
12+
targets: ["VaporOAuth"]
13+
)
14+
],
515
dependencies: [
6-
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 2),
7-
.Package(url: "https://github.com/vapor/auth-provider.git", majorVersion: 1),
16+
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0")
17+
],
18+
targets: [
19+
.target(
20+
name: "VaporOAuth",
21+
dependencies: [.product(name: "Vapor", package: "vapor")]
22+
),
23+
.testTarget(name: "VaporOAuthTests", dependencies: [
24+
.target(name: "VaporOAuth"),
25+
.product(name: "XCTVapor", package: "vapor")
26+
])
827
]
928
)

Package@swift-4.swift

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import HTTP
2-
import URI
1+
import Vapor
32

43
public struct EmptyAuthorizationHandler: AuthorizeHandler {
5-
64
public init() {}
75

8-
public func handleAuthorizationError(_ errorType: AuthorizationError) throws -> ResponseRepresentable {
9-
return ""
6+
public func handleAuthorizationRequest(
7+
_ request: Request,
8+
authorizationRequestObject: AuthorizationRequestObject
9+
) async throws -> Response {
10+
Response(body: "")
1011
}
1112

12-
public func handleAuthorizationRequest(_ request: Request,
13-
authorizationRequestObject: AuthorizationRequestObject) throws -> ResponseRepresentable {
14-
return ""
13+
public func handleAuthorizationError(_ errorType: AuthorizationError) async throws -> Response {
14+
Response(body: "")
1515
}
1616
}

Sources/VaporOAuth/DefaultImplementations/EmptyCodeManager.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
import Node
2-
31
public struct EmptyCodeManager: CodeManager {
42
public init() {}
53

64
public func getCode(_ code: String) -> OAuthCode? {
75
return nil
86
}
97

10-
public func generateCode(userID: Identifier, clientID: String, redirectURI: String, scopes: [String]?) throws -> String {
8+
public func generateCode(
9+
userID: String,
10+
clientID: String,
11+
redirectURI: String,
12+
scopes: [String]?
13+
) throws -> String {
1114
return ""
1215
}
1316

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import Node
2-
31
public struct EmptyUserManager: UserManager {
42

53
public init() {}
64

7-
public func getUser(userID: Identifier) -> OAuthUser? {
5+
public func getUser(userID: String) -> OAuthUser? {
86
return nil
97
}
108

11-
public func authenticateUser(username: String, password: String) -> Identifier? {
9+
public func authenticateUser(username: String, password: String) -> String? {
1210
return nil
1311
}
1412
}

Sources/VaporOAuth/Helper/Helper.swift

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)