Make validateToken public

This commit is contained in:
marcos
2017-12-15 17:16:37 -03:00
parent 0b8b59cae5
commit 6a1e91b1e9

View File

@@ -12,7 +12,7 @@ import (
) )
func NewPlayground(rw http.ResponseWriter, req *http.Request) { func NewPlayground(rw http.ResponseWriter, req *http.Request) {
if !validateToken(req) { if !ValidateToken(req) {
rw.WriteHeader(http.StatusForbidden) rw.WriteHeader(http.StatusForbidden)
return return
} }
@@ -37,7 +37,7 @@ func NewPlayground(rw http.ResponseWriter, req *http.Request) {
} }
func ListPlaygrounds(rw http.ResponseWriter, req *http.Request) { func ListPlaygrounds(rw http.ResponseWriter, req *http.Request) {
if !validateToken(req) { if !ValidateToken(req) {
rw.WriteHeader(http.StatusForbidden) rw.WriteHeader(http.StatusForbidden)
return return
} }
@@ -78,7 +78,7 @@ func GetCurrentPlayground(rw http.ResponseWriter, req *http.Request) {
}) })
} }
func validateToken(req *http.Request) bool { func ValidateToken(req *http.Request) bool {
_, password, ok := req.BasicAuth() _, password, ok := req.BasicAuth()
if !ok { if !ok {
return false return false