MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / urlAuth

Function urlAuth

src/authentication.go:102–133  ·  view source on GitHub ↗
(r *http.Request, requestType string)

Source from the content-addressed store, hash-verified

100}
101
102func 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
135func checkAuthorizationLevel(token, level string) (err error) {
136

Callers 1

ThreadfinFunction · 0.85

Calls 2

UserAuthenticationFunction · 0.92
checkAuthorizationLevelFunction · 0.85

Tested by

no test coverage detected