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

Commit

Permalink
loosen ReferenceWritableKeyPath requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Feb 20, 2018
1 parent 09ab477 commit 3b2a5d8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Sources/Authentication/Basic/BasicAuthenticatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import Fluent
/// Authenticatable by `Basic username:password` auth.
public protocol BasicAuthenticatable: Authenticatable {
/// Key path to the username
typealias UsernameKey = ReferenceWritableKeyPath<Self, String>
typealias UsernameKey = WritableKeyPath<Self, String>

/// The key under which the user's username,
/// email, or other identifing value is stored.
static var usernameKey: UsernameKey { get }

/// Key path to the password
typealias PasswordKey = ReferenceWritableKeyPath<Self, String>
typealias PasswordKey = WritableKeyPath<Self, String>

/// The key under which the user's password
/// is stored.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Authentication/Bearer/BearerAuthenticatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Fluent
/// Authenticatable by `Bearer token` auth.
public protocol BearerAuthenticatable: Authenticatable {
/// Key path to the token
typealias TokenKey = ReferenceWritableKeyPath<Self, String>
typealias TokenKey = WritableKeyPath<Self, String>

/// The key under which the model's unique token is stored.
static var tokenKey: TokenKey { get }
Expand Down
2 changes: 1 addition & 1 deletion Sources/Authentication/TokenAuthenticatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public protocol Token: BearerAuthenticatable {
where UserType.Database == Database

/// A relation to the user that owns this token.
static var userIDKey: ReferenceWritableKeyPath<Self, UserType.ID> { get }
static var userIDKey: WritableKeyPath<Self, UserType.ID> { get }
}

extension TokenAuthenticatable {
Expand Down
4 changes: 2 additions & 2 deletions Tests/AuthenticationTests/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class User: Model, Migration, BasicAuthenticatable {
typealias ID = UUID

static let idKey: IDKey = \User.id
static let usernameKey = \User.email
static let passwordKey = \User.password
static let usernameKey: UsernameKey = \User.email
static let passwordKey: PasswordKey = \User.password

var id: UUID?
var name: String
Expand Down

0 comments on commit 3b2a5d8

Please sign in to comment.