Commit 69178b8246ba6b2d9633653d24aa7dc21a074e56
1 parent
65d214f47d
Exists in
master
changed middleware
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
middleware/main.go
1 | package middleware | 1 | package middleware |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "net/http" | 4 | "net/http" |
5 | ) | 5 | ) |
6 | 6 | ||
7 | func Headers(h http.HandlerFunc) http.HandlerFunc { | 7 | func Headers(h http.HandlerFunc) http.HandlerFunc { |
8 | return SetAccessControlHeaders(IgnoreOptionsRequests(ParseForm(h))) | 8 | return SetAccessControlHeaders(IgnoreOptionsRequests(ParseForm(h))) |
9 | } | 9 | } |
10 | 10 | ||
11 | func AuthUser(roles string, h http.HandlerFunc) http.HandlerFunc { | 11 | func AuthUser(roles string, h http.HandlerFunc) http.HandlerFunc { |
12 | return SetAccessControlHeaders(IgnoreOptionsRequests(ParseForm(Auth(roles, h)))) | 12 | return SetAccessControlHeaders(IgnoreOptionsRequests(ParseForm(Auth(roles, h)))) |
13 | } | 13 | } |
14 | 14 | ||
15 | func AuthUserLogTraffic(roles string, h http.HandlerFunc) http.HandlerFunc { | 15 | func AuthUserAndLog(roles string, h http.HandlerFunc) http.HandlerFunc { |
16 | return SetAccessControlHeaders(IgnoreOptionsRequests(ParseForm(LogHTTP(Auth(roles, h))))) | 16 | return SetAccessControlHeaders(IgnoreOptionsRequests(ParseForm(LogHTTP(Auth(roles, h))))) |
17 | } | 17 | } |
18 | 18 | ||
19 | func LogTraffic(h http.HandlerFunc) http.HandlerFunc { | 19 | func LogTraffic(h http.HandlerFunc) http.HandlerFunc { |
20 | return SetAccessControlHeaders(IgnoreOptionsRequests(ParseForm(LogHTTP(h)))) | 20 | return SetAccessControlHeaders(IgnoreOptionsRequests(ParseForm(LogHTTP(h)))) |
21 | } | 21 | } |
22 | 22 |