fix xsrf
This commit is contained in:
parent
204aec8135
commit
824f46979b
6 changed files with 69 additions and 103 deletions
|
|
@ -57,11 +57,11 @@ func (s *HTTPServer) Start() (err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
opts := []jwt.JWTOption{jwt.WithBlacklist(s.DB), jwt.WithNonce()}
|
||||
if s.Config.Secret != "" {
|
||||
s.JWT, err = jwt.New(jwt.DefaultExpiry, s.DB, bytes.NewBufferString(s.Config.Secret))
|
||||
} else {
|
||||
s.JWT, err = jwt.New(jwt.DefaultExpiry, s.DB, nil)
|
||||
opts = append(opts, jwt.WithSecret(bytes.NewBufferString(s.Config.Secret)))
|
||||
}
|
||||
s.JWT, err = jwt.New(opts...)
|
||||
if err != nil {
|
||||
return errors.New("server: " + err.Error())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue