Use header instead of url parameter
This commit is contained in:
parent
7f31536315
commit
23692377e8
@ -4,7 +4,9 @@ import Vapor
|
|||||||
private let decoder = JSONDecoder()
|
private let decoder = JSONDecoder()
|
||||||
|
|
||||||
private func authorize(_ request: Request) throws {
|
private func authorize(_ request: Request) throws {
|
||||||
let key = try request.query.get(String.self, at: "key")
|
guard let key = request.headers.first(name: "key") else {
|
||||||
|
throw Abort(.badRequest)
|
||||||
|
}
|
||||||
guard server.hasAuthorization(for: key) else {
|
guard server.hasAuthorization(for: key) else {
|
||||||
throw Abort(.forbidden)
|
throw Abort(.forbidden)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user