Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.

Commit

Permalink
swift 4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Sep 13, 2017
1 parent dead10f commit 4964560
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,4 +4,5 @@
/*.xcodeproj
Package.pins
DerivedData/
Package.resolved

19 changes: 19 additions & 0 deletions Package@swift-4.swift
@@ -0,0 +1,19 @@
// swift-tools-version:4.0
import PackageDescription

let package = Package(
name: "Auth",
products: [
.library(name: "Authentication", targets: ["Authentication"]),
.library(name: "Authorization", targets: ["Authorization"]),
],
dependencies: [
// Swift models, relationships, and querying for NoSQL and SQL databases.
.package(url: "https://github.com/vapor/fluent.git", .upToNextMajor(from: "2.0.0"))
],
targets: [
.target(name: "Authentication", dependencies: ["Fluent"]),
.testTarget(name: "AuthenticationTests", dependencies: ["Authentication"]),
.target(name: "Authorization", dependencies: ["Authentication"]),
]
)
Expand Up @@ -34,7 +34,7 @@ extension TokenAuthenticatable where Self: Entity, Self.TokenType: Entity {
}
}

extension TokenAuthenticatable where Self: Entity, Self.TokenType: Entity, Self.TokenType == Self {
extension TokenAuthenticatable where Self: Entity, Self.TokenType == Self {
public static func authenticate(_ token: Token) throws -> Self {
guard let user = try Self.makeQuery()
.filter(tokenKey, token.string)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Authorization/Authorizable.swift
Expand Up @@ -67,7 +67,7 @@ extension PivotProtocol where Self.Right: Permission {
extension Authorizable {
public func isAuthorized<
PermissionType: Permission,
MiddleType: Entity,
MiddleType,
PivotType: PivotProtocol & Entity
>(
to permission: PermissionType,
Expand All @@ -89,7 +89,7 @@ extension Authorizable {

public func assertAuthorization<
PermissionType: Permission,
MiddleType: Entity,
MiddleType,
PivotType: PivotProtocol & Entity
>(
to permission: PermissionType,
Expand Down

0 comments on commit 4964560

Please sign in to comment.