Skip to content

Commit

Permalink
Merge pull request #21 from skelpo/develop
Browse files Browse the repository at this point in the history
Fixed compiler errors from dependency updates
  • Loading branch information
calebkleveter committed Jan 2, 2019
2 parents d288946 + dda9e34 commit 67e7ac0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/fluent-mysql.git", from: "3.0.0-rc"),
.package(url: "https://github.com/vapor/jwt.git", from: "3.0.0-rc"),
.package(url: "https://github.com/vapor/fluent-mysql.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/jwt.git", from: "3.0.0"),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "0.9.0"),
.package(url: "https://github.com/vapor-community/sendgrid-provider.git", from: "3.0.3"),
.package(url: "https://github.com/vapor-community/lingo-vapor.git", from: "3.0.0"),
Expand Down
2 changes: 1 addition & 1 deletion Sources/App/Controllers/AdminController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class AdminController: RouteCollection {
// Create a route-group that only allows
// admin users to access the endpoint.
let admin = router.grouped(
PermissionsMiddleware<UserStatus, Payload>(allowed: [.admin]),
PermissionsMiddleware<Payload>(allowed: [.admin]),
JWTVerificationMiddleware()
)

Expand Down
7 changes: 4 additions & 3 deletions Sources/App/Controllers/AuthController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class AuthController: RouteCollection {
func boot(router: Router) throws {

let auth = router.grouped(any, "users")
let restricted = auth.grouped(PermissionsMiddleware<UserStatus, Payload>(allowed: [.admin]))
let restricted = auth.grouped(PermissionsMiddleware<Payload>(allowed: [.admin]))
let protected = auth.grouped(JWTAuthenticatableMiddleware<User>())

auth.post("newPassword", use: newPassword)
Expand Down Expand Up @@ -139,8 +139,9 @@ final class AuthController: RouteCollection {
func refreshAccessToken(_ request: Request)throws -> Future<[String: String]> {
// Get refresh token from request body and verify it.
let refreshToken = try request.content.syncGet(String.self, at: "refreshToken")
let refreshJWT = try JWT<RefreshToken>(from: refreshToken, verifiedUsing: self.jwtService.signer)
try refreshJWT.payload.verify(using: self.jwtService.signer)
let refreshJWT = try JWT<RefreshToken>(from: refreshToken, verifiedUsing: signer.signer)
try refreshJWT.payload.verify(using: signer.signer)

// Get the user with the ID that was just fetched.
let userID = refreshJWT.payload.id
let user = User.find(userID, on: request).unwrap(or: Abort(.badRequest, reason: "No user found with ID '\(userID)'."))
Expand Down
2 changes: 1 addition & 1 deletion Sources/App/Models/User/User+HTTP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extension Request {

/// Conforms the `User` model to the `BasicJWTAuthenticatable` protocol.
/// This allows verfication of the `User` model with `JWTAuthenticatableMiddleware`.
extension User: BasicJWTAuthenticatable {
extension User: BasicJWTAuthenticatable {

/// The key-path for the property to check against `AuthBody.username`
/// when fetching the user form the database to authenticate.
Expand Down

0 comments on commit 67e7ac0

Please sign in to comment.