fix: import cycle issues
This commit is contained in:
@@ -14,8 +14,10 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/email"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
)
|
||||
|
||||
// ForgotPasswordResolver is a resolver for forgot password mutation
|
||||
@@ -39,7 +41,7 @@ func ForgotPasswordResolver(ctx context.Context, params model.ForgotPasswordInpu
|
||||
}
|
||||
params.Email = strings.ToLower(params.Email)
|
||||
|
||||
if !utils.IsValidEmail(params.Email) {
|
||||
if !validators.IsValidEmail(params.Email) {
|
||||
log.Debug("Invalid email address: ", params.Email)
|
||||
return res, fmt.Errorf("invalid email")
|
||||
}
|
||||
@@ -53,13 +55,13 @@ func ForgotPasswordResolver(ctx context.Context, params model.ForgotPasswordInpu
|
||||
return res, fmt.Errorf(`user with this email not found`)
|
||||
}
|
||||
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
_, nonceHash, err := utils.GenerateNonce()
|
||||
if err != nil {
|
||||
log.Debug("Failed to generate nonce: ", err)
|
||||
return res, err
|
||||
}
|
||||
redirectURL := utils.GetAppURL(gc) + "/reset-password"
|
||||
redirectURL := parsers.GetAppURL(gc) + "/reset-password"
|
||||
if params.RedirectURI != nil {
|
||||
redirectURL = *params.RedirectURI
|
||||
}
|
||||
|
@@ -15,8 +15,10 @@ import (
|
||||
emailservice "github.com/authorizerdev/authorizer/server/email"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
)
|
||||
|
||||
// InviteMembersResolver resolver to invite members
|
||||
@@ -54,7 +56,7 @@ func InviteMembersResolver(ctx context.Context, params model.InviteMemberInput)
|
||||
// filter valid emails
|
||||
emails := []string{}
|
||||
for _, email := range params.Emails {
|
||||
if utils.IsValidEmail(email) {
|
||||
if validators.IsValidEmail(email) {
|
||||
emails = append(emails, email)
|
||||
}
|
||||
}
|
||||
@@ -93,9 +95,9 @@ func InviteMembersResolver(ctx context.Context, params model.InviteMemberInput)
|
||||
Email: email,
|
||||
Roles: strings.Join(defaultRoles, ","),
|
||||
}
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
verifyEmailURL := hostname + "/verify_email"
|
||||
appURL := utils.GetAppURL(gc)
|
||||
appURL := parsers.GetAppURL(gc)
|
||||
|
||||
redirectURL := appURL
|
||||
if params.RedirectURI != nil {
|
||||
|
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
)
|
||||
|
||||
// LoginResolver is a resolver for login mutation
|
||||
@@ -78,7 +79,7 @@ func LoginResolver(ctx context.Context, params model.LoginInput) (*model.AuthRes
|
||||
}
|
||||
currentRoles := strings.Split(user.Roles, ",")
|
||||
if len(params.Roles) > 0 {
|
||||
if !utils.IsValidRoles(params.Roles, currentRoles) {
|
||||
if !validators.IsValidRoles(params.Roles, currentRoles) {
|
||||
log.Debug("Invalid roles: ", params.Roles)
|
||||
return res, fmt.Errorf(`invalid roles`)
|
||||
}
|
||||
|
@@ -14,8 +14,10 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/email"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
)
|
||||
|
||||
// MagicLinkLoginResolver is a resolver for magic link login mutation
|
||||
@@ -41,7 +43,7 @@ func MagicLinkLoginResolver(ctx context.Context, params model.MagicLinkLoginInpu
|
||||
|
||||
params.Email = strings.ToLower(params.Email)
|
||||
|
||||
if !utils.IsValidEmail(params.Email) {
|
||||
if !validators.IsValidEmail(params.Email) {
|
||||
log.Debug("Invalid email")
|
||||
return res, fmt.Errorf(`invalid email address`)
|
||||
}
|
||||
@@ -77,7 +79,7 @@ func MagicLinkLoginResolver(ctx context.Context, params model.MagicLinkLoginInpu
|
||||
log.Debug("Error getting roles: ", err)
|
||||
return res, err
|
||||
}
|
||||
if !utils.IsValidRoles(params.Roles, roles) {
|
||||
if !validators.IsValidRoles(params.Roles, roles) {
|
||||
log.Debug("Invalid roles: ", params.Roles)
|
||||
return res, fmt.Errorf(`invalid roles`)
|
||||
} else {
|
||||
@@ -158,7 +160,7 @@ func MagicLinkLoginResolver(ctx context.Context, params model.MagicLinkLoginInpu
|
||||
}
|
||||
}
|
||||
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
isEmailVerificationDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableEmailVerification)
|
||||
if err != nil {
|
||||
log.Debug("Error getting email verification disabled: ", err)
|
||||
@@ -178,7 +180,7 @@ func MagicLinkLoginResolver(ctx context.Context, params model.MagicLinkLoginInpu
|
||||
if params.Scope != nil && len(params.Scope) > 0 {
|
||||
redirectURLParams = redirectURLParams + "&scope=" + strings.Join(params.Scope, " ")
|
||||
}
|
||||
redirectURL := utils.GetAppURL(gc)
|
||||
redirectURL := parsers.GetAppURL(gc)
|
||||
if params.RedirectURI != nil {
|
||||
redirectURL = *params.RedirectURI
|
||||
}
|
||||
|
@@ -3,12 +3,90 @@ package resolvers
|
||||
import (
|
||||
"context"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
)
|
||||
|
||||
// MetaResolver is a resolver for meta query
|
||||
func MetaResolver(ctx context.Context) (*model.Meta, error) {
|
||||
metaInfo := utils.GetMetaInfo()
|
||||
clientID, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyClientID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
googleClientID, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyGoogleClientID)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Google Client ID from environment variable", err)
|
||||
googleClientID = ""
|
||||
}
|
||||
|
||||
googleClientSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyGoogleClientSecret)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Google Client Secret from environment variable", err)
|
||||
googleClientSecret = ""
|
||||
}
|
||||
|
||||
facebookClientID, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyFacebookClientID)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Facebook Client ID from environment variable", err)
|
||||
facebookClientID = ""
|
||||
}
|
||||
|
||||
facebookClientSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyFacebookClientSecret)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Facebook Client Secret from environment variable", err)
|
||||
facebookClientSecret = ""
|
||||
}
|
||||
|
||||
githubClientID, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyGithubClientID)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Github Client ID from environment variable", err)
|
||||
githubClientID = ""
|
||||
}
|
||||
|
||||
githubClientSecret, err := memorystore.Provider.GetStringStoreEnvVariable(constants.EnvKeyGithubClientSecret)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Github Client Secret from environment variable", err)
|
||||
githubClientSecret = ""
|
||||
}
|
||||
|
||||
isBasicAuthDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableBasicAuthentication)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Disable Basic Authentication from environment variable", err)
|
||||
isBasicAuthDisabled = true
|
||||
}
|
||||
|
||||
isEmailVerificationDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableEmailVerification)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Disable Email Verification from environment variable", err)
|
||||
isEmailVerificationDisabled = true
|
||||
}
|
||||
|
||||
isMagicLinkLoginDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableMagicLinkLogin)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Disable Magic Link Login from environment variable", err)
|
||||
isMagicLinkLoginDisabled = true
|
||||
}
|
||||
|
||||
isSignUpDisabled, err := memorystore.Provider.GetBoolStoreEnvVariable(constants.EnvKeyDisableSignUp)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get Disable Signup from environment variable", err)
|
||||
isSignUpDisabled = true
|
||||
}
|
||||
|
||||
metaInfo := model.Meta{
|
||||
Version: constants.VERSION,
|
||||
ClientID: clientID,
|
||||
IsGoogleLoginEnabled: googleClientID != "" && googleClientSecret != "",
|
||||
IsGithubLoginEnabled: githubClientID != "" && githubClientSecret != "",
|
||||
IsFacebookLoginEnabled: facebookClientID != "" && facebookClientSecret != "",
|
||||
IsBasicAuthenticationEnabled: !isBasicAuthDisabled,
|
||||
IsEmailVerificationEnabled: !isEmailVerificationDisabled,
|
||||
IsMagicLinkLoginEnabled: !isMagicLinkLoginDisabled,
|
||||
IsSignUpEnabled: !isSignUpDisabled,
|
||||
}
|
||||
return &metaInfo, nil
|
||||
}
|
||||
|
@@ -12,8 +12,10 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/db/models"
|
||||
"github.com/authorizerdev/authorizer/server/email"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
)
|
||||
|
||||
// ResendVerifyEmailResolver is a resolver for resend verify email mutation
|
||||
@@ -27,12 +29,12 @@ func ResendVerifyEmailResolver(ctx context.Context, params model.ResendVerifyEma
|
||||
}
|
||||
params.Email = strings.ToLower(params.Email)
|
||||
|
||||
if !utils.IsValidEmail(params.Email) {
|
||||
if !validators.IsValidEmail(params.Email) {
|
||||
log.Debug("Invalid email: ", params.Email)
|
||||
return res, fmt.Errorf("invalid email")
|
||||
}
|
||||
|
||||
if !utils.IsValidVerificationIdentifier(params.Identifier) {
|
||||
if !validators.IsValidVerificationIdentifier(params.Identifier) {
|
||||
log.Debug("Invalid verification identifier: ", params.Identifier)
|
||||
return res, fmt.Errorf("invalid identifier")
|
||||
}
|
||||
@@ -49,7 +51,7 @@ func ResendVerifyEmailResolver(ctx context.Context, params model.ResendVerifyEma
|
||||
log.Debug("Failed to delete verification request: ", err)
|
||||
}
|
||||
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
_, nonceHash, err := utils.GenerateNonce()
|
||||
if err != nil {
|
||||
log.Debug("Failed to generate nonce: ", err)
|
||||
|
@@ -13,8 +13,10 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
)
|
||||
|
||||
// ResetPasswordResolver is a resolver for reset password mutation
|
||||
@@ -48,13 +50,13 @@ func ResetPasswordResolver(ctx context.Context, params model.ResetPasswordInput)
|
||||
return res, fmt.Errorf(`passwords don't match`)
|
||||
}
|
||||
|
||||
if !utils.IsValidPassword(params.Password) {
|
||||
if !validators.IsValidPassword(params.Password) {
|
||||
log.Debug("Invalid password")
|
||||
return res, fmt.Errorf(`password is not valid. It needs to be at least 6 characters long and contain at least one number, one uppercase letter, one lowercase letter and one special character`)
|
||||
}
|
||||
|
||||
// verify if token exists in db
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
claim, err := token.ParseJWTToken(params.Token, hostname, verificationRequest.Nonce, verificationRequest.Email)
|
||||
if err != nil {
|
||||
log.Debug("Failed to parse token: ", err)
|
||||
|
@@ -16,8 +16,10 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/email"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
)
|
||||
|
||||
// SignupResolver is a resolver for signup mutation
|
||||
@@ -56,14 +58,14 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
|
||||
return res, fmt.Errorf(`password and confirm password does not match`)
|
||||
}
|
||||
|
||||
if !utils.IsValidPassword(params.Password) {
|
||||
if !validators.IsValidPassword(params.Password) {
|
||||
log.Debug("Invalid password")
|
||||
return res, fmt.Errorf(`password is not valid. It needs to be at least 6 characters long and contain at least one number, one uppercase letter, one lowercase letter and one special character`)
|
||||
}
|
||||
|
||||
params.Email = strings.ToLower(params.Email)
|
||||
|
||||
if !utils.IsValidEmail(params.Email) {
|
||||
if !validators.IsValidEmail(params.Email) {
|
||||
log.Debug("Invalid email: ", params.Email)
|
||||
return res, fmt.Errorf(`invalid email address`)
|
||||
}
|
||||
@@ -95,7 +97,7 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
|
||||
log.Debug("Error getting roles: ", err)
|
||||
return res, err
|
||||
}
|
||||
if !utils.IsValidRoles(roles, params.Roles) {
|
||||
if !validators.IsValidRoles(roles, params.Roles) {
|
||||
log.Debug("Invalid roles: ", params.Roles)
|
||||
return res, fmt.Errorf(`invalid roles`)
|
||||
} else {
|
||||
@@ -168,7 +170,7 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
|
||||
roles := strings.Split(user.Roles, ",")
|
||||
userToReturn := user.AsAPIUser()
|
||||
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
if !isEmailVerificationDisabled {
|
||||
// insert verification request
|
||||
_, nonceHash, err := utils.GenerateNonce()
|
||||
@@ -177,7 +179,7 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
|
||||
return res, err
|
||||
}
|
||||
verificationType := constants.VerificationTypeBasicAuthSignup
|
||||
redirectURL := utils.GetAppURL(gc)
|
||||
redirectURL := parsers.GetAppURL(gc)
|
||||
if params.RedirectURI != nil {
|
||||
redirectURL = *params.RedirectURI
|
||||
}
|
||||
|
@@ -16,8 +16,10 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/email"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
@@ -121,14 +123,14 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||
|
||||
if params.Email != nil && user.Email != *params.Email {
|
||||
// check if valid email
|
||||
if !utils.IsValidEmail(*params.Email) {
|
||||
if !validators.IsValidEmail(*params.Email) {
|
||||
log.Debug("Failed to validate email: ", *params.Email)
|
||||
return res, fmt.Errorf("invalid email address")
|
||||
}
|
||||
newEmail := strings.ToLower(*params.Email)
|
||||
|
||||
// check if valid email
|
||||
if !utils.IsValidEmail(newEmail) {
|
||||
if !validators.IsValidEmail(newEmail) {
|
||||
log.Debug("Failed to validate new email: ", newEmail)
|
||||
return res, fmt.Errorf("invalid new email address")
|
||||
}
|
||||
@@ -150,7 +152,7 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||
return res, err
|
||||
}
|
||||
if !isEmailVerificationDisabled {
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
user.EmailVerifiedAt = nil
|
||||
hasEmailChanged = true
|
||||
// insert verification request
|
||||
@@ -160,7 +162,7 @@ func UpdateProfileResolver(ctx context.Context, params model.UpdateProfileInput)
|
||||
return res, err
|
||||
}
|
||||
verificationType := constants.VerificationTypeUpdateEmail
|
||||
redirectURL := utils.GetAppURL(gc)
|
||||
redirectURL := parsers.GetAppURL(gc)
|
||||
verificationToken, err := token.CreateVerificationToken(newEmail, verificationType, hostname, nonceHash, redirectURL)
|
||||
if err != nil {
|
||||
log.Debug("Failed to create verification token: ", err)
|
||||
|
@@ -14,8 +14,10 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/email"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
"github.com/authorizerdev/authorizer/server/validators"
|
||||
)
|
||||
|
||||
// UpdateUserResolver is a resolver for update user mutation
|
||||
@@ -97,7 +99,7 @@ func UpdateUserResolver(ctx context.Context, params model.UpdateUserInput) (*mod
|
||||
|
||||
if params.Email != nil && user.Email != *params.Email {
|
||||
// check if valid email
|
||||
if !utils.IsValidEmail(*params.Email) {
|
||||
if !validators.IsValidEmail(*params.Email) {
|
||||
log.Debug("Invalid email: ", *params.Email)
|
||||
return res, fmt.Errorf("invalid email address")
|
||||
}
|
||||
@@ -113,7 +115,7 @@ func UpdateUserResolver(ctx context.Context, params model.UpdateUserInput) (*mod
|
||||
// TODO figure out how to do this
|
||||
go memorystore.Provider.DeleteAllUserSession(user.ID)
|
||||
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
user.Email = newEmail
|
||||
user.EmailVerifiedAt = nil
|
||||
// insert verification request
|
||||
@@ -123,7 +125,7 @@ func UpdateUserResolver(ctx context.Context, params model.UpdateUserInput) (*mod
|
||||
return res, err
|
||||
}
|
||||
verificationType := constants.VerificationTypeUpdateEmail
|
||||
redirectURL := utils.GetAppURL(gc)
|
||||
redirectURL := parsers.GetAppURL(gc)
|
||||
verificationToken, err := token.CreateVerificationToken(newEmail, verificationType, hostname, nonceHash, redirectURL)
|
||||
if err != nil {
|
||||
log.Debug("Failed to create verification token: ", err)
|
||||
@@ -163,12 +165,12 @@ func UpdateUserResolver(ctx context.Context, params model.UpdateUserInput) (*mod
|
||||
log.Debug("Error getting protected roles: ", err)
|
||||
}
|
||||
|
||||
if !utils.IsValidRoles(inputRoles, append([]string{}, append(roles, protectedRoles...)...)) {
|
||||
if !validators.IsValidRoles(inputRoles, append([]string{}, append(roles, protectedRoles...)...)) {
|
||||
log.Debug("Invalid roles: ", params.Roles)
|
||||
return res, fmt.Errorf("invalid list of roles")
|
||||
}
|
||||
|
||||
if !utils.IsStringArrayEqual(inputRoles, currentRoles) {
|
||||
if !validators.IsStringArrayEqual(inputRoles, currentRoles) {
|
||||
rolesToSave = strings.Join(inputRoles, ",")
|
||||
}
|
||||
|
||||
|
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
)
|
||||
@@ -49,7 +50,7 @@ func ValidateJwtTokenResolver(ctx context.Context, params model.ValidateJWTToken
|
||||
userID = savedSessionSplit[1]
|
||||
}
|
||||
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
var claimRoles []string
|
||||
var claims jwt.MapClaims
|
||||
|
||||
|
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/db/models"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/parsers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
)
|
||||
@@ -34,7 +35,7 @@ func VerifyEmailResolver(ctx context.Context, params model.VerifyEmailInput) (*m
|
||||
}
|
||||
|
||||
// verify if token exists in db
|
||||
hostname := utils.GetHost(gc)
|
||||
hostname := parsers.GetHost(gc)
|
||||
claim, err := token.ParseJWTToken(params.Token, hostname, verificationRequest.Nonce, verificationRequest.Email)
|
||||
if err != nil {
|
||||
log.Debug("Failed to parse token: ", err)
|
||||
|
Reference in New Issue
Block a user