Browse Source
Move authorization middleware to dedicated middlewares package
feature/update-route-registration
Fabian Vowie
3 years ago
No known key found for this signature in database
GPG Key ID: C27317C33B27C410
3 changed files with
4 additions and
4 deletions
-
main.go
-
middlewares/authorization.go
-
middlewares/authorization_test.go
|
@ -4,7 +4,7 @@ import ( |
|
|
"encoding/json" |
|
|
"encoding/json" |
|
|
"net/http" |
|
|
"net/http" |
|
|
|
|
|
|
|
|
"github.com/geplauder/lithium/auth" |
|
|
|
|
|
|
|
|
"github.com/geplauder/lithium/middlewares" |
|
|
"github.com/geplauder/lithium/pipelines" |
|
|
"github.com/geplauder/lithium/pipelines" |
|
|
"github.com/geplauder/lithium/settings" |
|
|
"github.com/geplauder/lithium/settings" |
|
|
"github.com/geplauder/lithium/storage" |
|
|
"github.com/geplauder/lithium/storage" |
|
@ -60,7 +60,7 @@ func main() { |
|
|
|
|
|
|
|
|
pipes := pipelines.LoadPipelines() |
|
|
pipes := pipelines.LoadPipelines() |
|
|
|
|
|
|
|
|
authMiddleware := auth.CreateAuthenticationMiddleware(appSettings.Token) |
|
|
|
|
|
|
|
|
authMiddleware := middlewares.CreateAuthenticationMiddleware(appSettings.Token) |
|
|
|
|
|
|
|
|
r := mux.NewRouter() |
|
|
r := mux.NewRouter() |
|
|
r.Use(authMiddleware.Middleware) |
|
|
r.Use(authMiddleware.Middleware) |
|
|
|
@ -1,4 +1,4 @@ |
|
|
package auth |
|
|
|
|
|
|
|
|
package middlewares |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"net/http" |
|
|
"net/http" |
|
@ -1,4 +1,4 @@ |
|
|
package auth |
|
|
|
|
|
|
|
|
package middlewares |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"net/http" |
|
|
"net/http" |