@@ -12,7 +12,7 @@ import (
1212)
1313
1414type AuthMiddleware struct {
15- Next http.Handler
15+ Next http.Handler
1616}
1717
1818func getAuthType (str string ) authType {
@@ -26,7 +26,7 @@ func getAuthType(str string) authType {
2626 }
2727}
2828
29- func isValidToken (tokens []string , match string ) ( bool ) {
29+ func isValidToken (tokens []string , match string ) bool {
3030 return slices .Contains (tokens , match )
3131}
3232
@@ -57,26 +57,26 @@ func (data AuthMiddleware) Use() http.Handler {
5757 authToken = authBody [1 ]
5858
5959 switch authType {
60- case Bearer :
61- if isValidToken (tokens , authToken ) {
62- success = true
63- }
60+ case Bearer :
61+ if isValidToken (tokens , authToken ) {
62+ success = true
63+ }
6464
65- case Basic :
66- basicAuthBody , err := base64 .StdEncoding .DecodeString (authToken )
65+ case Basic :
66+ basicAuthBody , err := base64 .StdEncoding .DecodeString (authToken )
6767
68- if err != nil {
69- log .Error ("Could not decode Basic Auth Payload: " , err .Error ())
70- }
68+ if err != nil {
69+ log .Error ("Could not decode Basic Auth Payload: " , err .Error ())
70+ }
7171
72- basicAuth := string (basicAuthBody )
73- basicAuthParams := strings .Split (basicAuth , ":" )
72+ basicAuth := string (basicAuthBody )
73+ basicAuthParams := strings .Split (basicAuth , ":" )
7474
75- user := "api"
75+ user := "api"
7676
77- if basicAuthParams [0 ] == user && isValidToken (tokens , basicAuthParams [1 ]) {
78- success = true
79- }
77+ if basicAuthParams [0 ] == user && isValidToken (tokens , basicAuthParams [1 ]) {
78+ success = true
79+ }
8080 }
8181
8282 } else if authQuery != "" {
0 commit comments