an signature checker middleware for go-json-rest
some API services only provided for authorized clients, this middleware verify an signature in request header, both client side and server side must use same secret key to generate/check signature
go get -u github.com/zx9597446/sigchecker
use this middleware with go-json-rest
secret := "abcd"
headerKey := "X-request-signature"
api := rest.NewApi()
api.Use(rest.DefaultDevStack...)
api.Use(NewSignatureChecker(headerKey, secret))
formation of signature in request header is:
timestamp,signature
to generate signature:
signature = md5(timestamp + secret)
see doc
see test