Added middleware to let excluded files skip middleware chain
This commit is contained in:
21
middleware/authentication.go
Normal file
21
middleware/authentication.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
// Take current request
|
||||
// Get cookies from browser
|
||||
// Parse the tokens
|
||||
// Check if tokens blacklisted
|
||||
// Trigger refresh if required
|
||||
// Create context with state of user authorization
|
||||
// Pass request on with context
|
||||
|
||||
func Authentication(logger *zerolog.Logger, next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user