Last active
December 20, 2016 18:01
-
-
Save calebkleveter/08ebd2326991b184d2140fe7e3865d06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case let id as Identifier: | |
guard let user = try User.find(id.id) else { | |
throw Abort.custom(status: .forbidden, message: "Invalid user identifier.") | |
} | |
return user | |
case let accessToken as AccessToken: | |
guard let user = try User.query().filter("access_token", accessToken.string).first() else { | |
throw Abort.custom(status: .forbidden, message: "Invalid access token.") | |
} | |
return user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment