Fix client token generation
- Set NotBefore timestamp one minute in the past to prevent false negative checks - Set NotAfter timestamp 5 minutes to the future
This commit is contained in:
parent
fbb2381b14
commit
dab91eea29
|
@ -9,7 +9,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
jwt "github.com/dgrijalva/jwt-go"
|
||||
|
||||
peering "forge.cadoles.com/wpetit/go-http-peering"
|
||||
"forge.cadoles.com/wpetit/go-http-peering/crypto"
|
||||
|
@ -153,8 +153,8 @@ func (c *Client) addClientToken(r *http.Request, body []byte) error {
|
|||
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodRS256, peering.ClientTokenClaims{
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
NotBefore: time.Now().Unix(),
|
||||
ExpiresAt: time.Now().Add(time.Minute * 10).Unix(),
|
||||
NotBefore: time.Now().Add(time.Minute * -1).Unix(),
|
||||
ExpiresAt: time.Now().Add(time.Minute * 5).Unix(),
|
||||
},
|
||||
BodySum: bodySum,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue