summaryrefslogtreecommitdiff
path: root/system/auth.go
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-05-01 01:51:46 -0500
committerGitHub <noreply@github.com>2017-05-01 01:51:46 -0500
commit8319420935c223e432bc4c386bd7d26b03f01b47 (patch)
tree8ebe1e3f0780f66530b723ce9b48f69ae664d764 /system/auth.go
parent7092fb8979869f3c09b364d454d8d8081bb7c0bc (diff)
parent8a1d091a0c6d55dbd6c713b2240bee8550541e7b (diff)
Merge pull request #137 from ponzu-cms/ponzu-dev
[core] adding file upload metadata type and API
Diffstat (limited to 'system/auth.go')
-rw-r--r--system/auth.go37
1 files changed, 0 insertions, 37 deletions
diff --git a/system/auth.go b/system/auth.go
deleted file mode 100644
index 8b12ab5..0000000
--- a/system/auth.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Package system contains a collection of packages that make up the internal
-// Ponzu system, which handles addons, administration, the Admin server, the API
-// server, analytics, databases, search, TLS, and various internal types.
-package system
-
-import (
- "net/http"
-
- "github.com/ponzu-cms/ponzu/system/db"
-)
-
-// BasicAuth adds HTTP Basic Auth check for requests that should implement it
-func BasicAuth(next http.HandlerFunc) http.HandlerFunc {
- return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
- u := db.ConfigCache("backup_basic_auth_user").(string)
- p := db.ConfigCache("backup_basic_auth_password").(string)
-
- if u == "" || p == "" {
- res.WriteHeader(http.StatusForbidden)
- return
- }
-
- user, password, ok := req.BasicAuth()
-
- if !ok {
- res.WriteHeader(http.StatusForbidden)
- return
- }
-
- if u != user || p != password {
- res.WriteHeader(http.StatusUnauthorized)
- return
- }
-
- next.ServeHTTP(res, req)
- })
-}