migrated out cookies module
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"projectreshoot/internal/view/component/form"
|
||||
"projectreshoot/pkg/config"
|
||||
"projectreshoot/pkg/contexts"
|
||||
"projectreshoot/pkg/cookies"
|
||||
|
||||
"git.haelnorr.com/h/golib/hlog"
|
||||
"git.haelnorr.com/h/golib/jwt"
|
||||
@@ -24,7 +23,7 @@ func getTokens(
|
||||
r *http.Request,
|
||||
) (*jwt.AccessToken, *jwt.RefreshToken, error) {
|
||||
// get the existing tokens from the cookies
|
||||
atStr, rtStr := cookies.GetTokenStrings(r)
|
||||
atStr, rtStr := jwt.GetTokenCookies(r)
|
||||
aT, err := tokenGen.ValidateAccess(tx, atStr)
|
||||
if err != nil {
|
||||
return nil, nil, errors.Wrap(err, "tokenGen.ValidateAccess")
|
||||
@@ -71,7 +70,7 @@ func refreshTokens(
|
||||
}[aT.TTL]
|
||||
// issue new tokens for the user
|
||||
user := contexts.GetUser(r.Context())
|
||||
err = cookies.SetTokenCookies(w, r, config, tokenGen, user.User, true, rememberMe)
|
||||
err = jwt.SetTokenCookies(w, r, tokenGen, user.ID, true, rememberMe, config.SSL)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "cookies.SetTokenCookies")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user