Skip to content

Commit 8980966

Browse files
committed
refactor(middleware): simplify CreateAuthMiddleware function
• Streamlines the creation of middleware by returning a slice directly
1 parent 5362057 commit 8980966

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

middleware/authzMiddlewares.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ import (
1212
// 2. StoreAuthHeader()
1313
// 3. StoreSpiffeHeader()
1414
func CreateAuthMiddleware() []func(http.Handler) http.Handler {
15-
mws := make([]func(http.Handler) http.Handler, 0, 5)
16-
17-
mws = append(mws, StoreWebToken())
18-
mws = append(mws, StoreAuthHeader())
19-
mws = append(mws, StoreSpiffeHeader())
20-
21-
return mws
15+
return []func(http.Handler) http.Handler{
16+
StoreWebToken(),
17+
StoreAuthHeader(),
18+
StoreSpiffeHeader(),
19+
}
2220
}

0 commit comments

Comments
 (0)