basic functions working
This commit is contained in:
parent
abc6159044
commit
ffeeae5702
22 changed files with 420 additions and 129 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
"git.giftfish.de/ston1th/jwt/v3"
|
||||
"github.com/gorilla/mux"
|
||||
"html/template"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
|
|
@ -27,7 +28,7 @@ func newContext(w http.ResponseWriter, r *http.Request, s *HTTPServer) *Context
|
|||
h.Set("X-Frame-Options", "sameorigin")
|
||||
h.Set("X-Content-Type-Options", "nosniff")
|
||||
h.Set("X-XSS-Protection", "1; mode=block")
|
||||
h.Set("Content-Security-Policy", "default-src 'none';object-src 'self';frame-src 'self';style-src 'self';img-src 'self' https: data:;connect-src 'self';frame-ancestors 'self'")
|
||||
h.Set("Content-Security-Policy", "default-src 'none';object-src 'self';frame-src 'self';style-src 'self';img-src 'self' data:;connect-src 'self';frame-ancestors 'self'")
|
||||
h.Set("Referrer-Policy", "same-origin")
|
||||
return &Context{
|
||||
Request: r,
|
||||
|
|
@ -202,6 +203,15 @@ func (c *Context) Var(name string) (ret string) {
|
|||
return
|
||||
}
|
||||
|
||||
func (c *Context) File(name string) (io.Reader, string, error) {
|
||||
var filename string
|
||||
f, fh, err := c.Request.FormFile(name)
|
||||
if fh != nil {
|
||||
filename = fh.Filename
|
||||
}
|
||||
return f, filename, err
|
||||
}
|
||||
|
||||
// CheckXsrf validates the xsrf token
|
||||
func (c *Context) CheckXsrf() (ok bool) {
|
||||
ok = checkXsrf(c.Form("token"), c.Token.RawSig()[:keySize])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue