Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed compiler errors from dependency updates #21

Merged
merged 5 commits into from
Jan 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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