mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
use random string instead of JWT for tokens. (#584)
uses a random URL encoded base64 string as the token for password reset and invites.
This commit is contained in:
parent
7812b2f3bd
commit
62a5e65c2e
2 changed files with 5 additions and 4 deletions
|
|
@ -1,9 +1,9 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
|
||||
jwt "github.com/dgrijalva/jwt-go"
|
||||
kolide_errors "github.com/kolide/kolide-ose/server/errors"
|
||||
"github.com/kolide/kolide-ose/server/kolide"
|
||||
"golang.org/x/net/context"
|
||||
|
|
@ -25,10 +25,11 @@ func (svc service) InviteNewUser(ctx context.Context, payload kolide.InvitePaylo
|
|||
return nil, err
|
||||
}
|
||||
|
||||
token, err := jwt.New(jwt.SigningMethodHS256).SignedString([]byte(svc.config.App.TokenKey))
|
||||
random, err := kolide.RandomText(svc.config.App.TokenKeySize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
token := base64.URLEncoding.EncodeToString([]byte(random))
|
||||
|
||||
invite := &kolide.Invite{
|
||||
Email: *payload.Email,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"encoding/base64"
|
||||
"time"
|
||||
|
||||
jwt "github.com/dgrijalva/jwt-go"
|
||||
"github.com/kolide/kolide-ose/server/contexts/viewer"
|
||||
"github.com/kolide/kolide-ose/server/kolide"
|
||||
"golang.org/x/net/context"
|
||||
|
|
@ -180,10 +179,11 @@ func (svc service) RequestPasswordReset(ctx context.Context, email string) error
|
|||
}
|
||||
}
|
||||
|
||||
token, err := jwt.New(jwt.SigningMethodHS256).SignedString([]byte(svc.config.App.TokenKey))
|
||||
random, err := kolide.RandomText(svc.config.App.TokenKeySize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
token := base64.URLEncoding.EncodeToString([]byte(random))
|
||||
|
||||
request := &kolide.PasswordResetRequest{
|
||||
UpdateCreateTimestamps: kolide.UpdateCreateTimestamps{
|
||||
|
|
|
|||
Loading…
Reference in a new issue