diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-10-19 13:50:05 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-10-19 13:50:05 -0700 |
commit | ea078f9b4221332b9f63cc4e178aa814eec06e4f (patch) | |
tree | a90da6f77f265ce63c82da73f502f324bfb89ebc /cmd/ponzu/vendor/github.com/nilslice/jwt/doc.go | |
parent | ea8ea4c22662aa082181a6c456ec56acf2bd777c (diff) |
vendoring all the dependencies into vendor directory prior to build step, which still vendors ponzu core code
Diffstat (limited to 'cmd/ponzu/vendor/github.com/nilslice/jwt/doc.go')
-rw-r--r-- | cmd/ponzu/vendor/github.com/nilslice/jwt/doc.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cmd/ponzu/vendor/github.com/nilslice/jwt/doc.go b/cmd/ponzu/vendor/github.com/nilslice/jwt/doc.go new file mode 100644 index 0000000..aa9a5c8 --- /dev/null +++ b/cmd/ponzu/vendor/github.com/nilslice/jwt/doc.go @@ -0,0 +1,40 @@ +// Package jwt provides methods to create and check JSON Web Tokens (JWT). It only implements HMAC 256 encryption and has a very small footprint, ideal for simple usage when authorizing clients +/* + + package main + + import ( + auth "github.com/nilslice/jwt" + "fmt" + "net/http" + "strings" + "time" + ) + + func main() { + http.HandleFunc("/auth/new", func(res http.ResponseWriter, req *http.Request) { + claims := map[string]interface{}{"exp": time.Now().Add(time.Hour * 24).Unix()} + token, err := auth.New(claims) + if err != nil { + http.Error(res, "Error", 500) + return + } + res.Header().Add("Authorization", "Bearer "+token) + + res.WriteHeader(http.StatusOK) + }) + + http.HandleFunc("/auth", func(res http.ResponseWriter, req *http.Request) { + userToken := strings.Split(req.Header.Get("Authorization"), " ")[1] + + if auth.Passes(userToken) { + fmt.Println("ok") + } else { + fmt.Println("no") + } + }) + + http.ListenAndServe(":8080", nil) + } +*/ +package jwt |