fix: memory store upgrade in resolvers

This commit is contained in:
Lakhan Samani
2022-05-30 09:19:55 +05:30
parent 43359f1dba
commit 268b22ffb2
47 changed files with 397 additions and 270 deletions

View File

@@ -9,8 +9,8 @@ import (
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/cookie"
"github.com/authorizerdev/authorizer/server/crypto"
"github.com/authorizerdev/authorizer/server/envstore"
"github.com/authorizerdev/authorizer/server/graph/model"
"github.com/authorizerdev/authorizer/server/memorystore"
"github.com/authorizerdev/authorizer/server/token"
"github.com/authorizerdev/authorizer/server/utils"
)
@@ -30,7 +30,12 @@ func AdminSessionResolver(ctx context.Context) (*model.Response, error) {
return res, fmt.Errorf("unauthorized")
}
hashedKey, err := crypto.EncryptPassword(envstore.EnvStoreObj.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret))
adminSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyAdminSecret)
if err != nil {
log.Debug("Error getting admin secret: ", err)
return res, fmt.Errorf("unauthorized")
}
hashedKey, err := crypto.EncryptPassword(adminSecret)
if err != nil {
log.Debug("Failed to encrypt key: ", err)
return res, err