Browse Source

Move authorization middleware to dedicated middlewares package

feature/update-route-registration
Fabian Vowie 3 years ago
parent
commit
2735d9c9e9
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  1. 4
      main.go
  2. 2
      middlewares/authorization.go
  3. 2
      middlewares/authorization_test.go

4
main.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)

2
auth/authorization.go → middlewares/authorization.go

@ -1,4 +1,4 @@
package auth
package middlewares
import ( import (
"net/http" "net/http"

2
auth/authorization_test.go → middlewares/authorization_test.go

@ -1,4 +1,4 @@
package auth
package middlewares
import ( import (
"net/http" "net/http"
Loading…
Cancel
Save