Make validateToken public
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user