(r *http.Request, requestType string)
| 100 | } |
| 101 | |
| 102 | func urlAuth(r *http.Request, requestType string) (err error) { |
| 103 | var level, token string |
| 104 | |
| 105 | var username = r.URL.Query().Get("username") |
| 106 | var password = r.URL.Query().Get("password") |
| 107 | |
| 108 | switch requestType { |
| 109 | |
| 110 | case "m3u": |
| 111 | level = "authentication.m3u" |
| 112 | if Settings.AuthenticationM3U == true { |
| 113 | token, err = authentication.UserAuthentication(username, password) |
| 114 | if err != nil { |
| 115 | return |
| 116 | } |
| 117 | err = checkAuthorizationLevel(token, level) |
| 118 | } |
| 119 | |
| 120 | case "xml": |
| 121 | level = "authentication.xml" |
| 122 | if Settings.AuthenticationXML == true { |
| 123 | token, err = authentication.UserAuthentication(username, password) |
| 124 | if err != nil { |
| 125 | return |
| 126 | } |
| 127 | err = checkAuthorizationLevel(token, level) |
| 128 | } |
| 129 | |
| 130 | } |
| 131 | |
| 132 | return |
| 133 | } |
| 134 | |
| 135 | func checkAuthorizationLevel(token, level string) (err error) { |
| 136 |
no test coverage detected