Skip to content

Instantly share code, notes, and snippets.

@calebkleveter
Last active December 20, 2016 17:59
Show Gist options
  • Save calebkleveter/8f070240c58d570a688bfb17554ae2e8 to your computer and use it in GitHub Desktop.
Save calebkleveter/8f070240c58d570a688bfb17554ae2e8 to your computer and use it in GitHub Desktop.
case let apiKey as APIKey:
guard let user = try User.query().filter("username", apiKey.id).first(),
try BCrypt.verify(password: apiKey.secret, matchesHash: user.password) else {
throw Abort.custom(status: .networkAuthenticationRequired, message: "Invalid user name or password.")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment