Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
[BUG] Auth Groups block incoming requests with valid auth (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Berzan Yildiz authored Apr 22, 2020
1 parent e7f1397 commit cf6108b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
branches: [master]
name-template: '$NEXT_PATCH_VERSION 🌈'
name-template: '$NEXT_PATCH_VERSION 🦅'
tag-template: '$NEXT_PATCH_VERSION'
categories:
- title: '🚀 Features'
Expand Down
4 changes: 2 additions & 2 deletions Sources/Corvus/Endpoints/Groups/BasicAuthGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public struct BasicAuthGroup<T: CorvusModelAuthenticatable>: Endpoint {
)

let guardedRoutesBuilder = groupedRoutesBuilder.grouped([
T.guardMiddleware(),
T.authenticator()
T.authenticator(),
T.guardMiddleware()
])

content.register(to: guardedRoutesBuilder)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Corvus/Endpoints/Groups/BearerAuthGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public struct BearerAuthGroup<T: CorvusModelTokenAuthenticatable>: Endpoint {
)

let guardedRoutesBuilder = groupedRoutesBuilder.grouped([
T.User.guardMiddleware(),
T.authenticator()
T.authenticator(),
T.User.guardMiddleware()
])

content.register(to: guardedRoutesBuilder)
Expand Down
3 changes: 2 additions & 1 deletion Sources/Corvus/Endpoints/Login.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Endpoint where T.User: CorvusModelAuthenticatable {
/// about the HTTP route leading to the current component.
public func register(to routes: RoutesBuilder) {
let guardedRoutesBuilder = routes.grouped(
T.User.authenticator()
T.User.authenticator(),
T.User.guardMiddleware()
)

guardedRoutesBuilder.post(path, use: handler)
Expand Down

0 comments on commit cf6108b

Please sign in to comment.