mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-25 22:18:23 +02:00
crypto: use actual bytes of shared secret, not the base64 encoded representation (#2075)
* crypto: use actual bytes of shared secret, not the base64 encoded representation * return errors * return errors
This commit is contained in:
parent
7a04b16163
commit
6d1d2bec54
7 changed files with 71 additions and 26 deletions
|
@ -28,12 +28,12 @@ func SetHeaders(headers map[string]string) func(next http.Handler) http.Handler
|
|||
|
||||
// ValidateSignature ensures the request is valid and has been signed with
|
||||
// the correspdoning client secret key
|
||||
func ValidateSignature(sharedSecret []byte) func(next http.Handler) http.Handler {
|
||||
func ValidateSignature(sharedKey []byte) func(next http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {
|
||||
ctx, span := trace.StartSpan(r.Context(), "middleware.ValidateSignature")
|
||||
defer span.End()
|
||||
if err := ValidateRequestURL(r, sharedSecret); err != nil {
|
||||
if err := ValidateRequestURL(r, sharedKey); err != nil {
|
||||
return httputil.NewError(http.StatusBadRequest, err)
|
||||
}
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue