fix: role validation for given token (#55)

This commit is contained in:
Lakhan Samani
2021-10-09 09:40:45 +05:30
committed by GitHub
parent f17ea64ffe
commit b0bf7690e5

View File

@@ -36,8 +36,8 @@ func Token(ctx context.Context, role *string) (*model.AuthResponse, error) {
return res, err
}
if role != nil && role != &claimRole {
return res, fmt.Errorf(`unauthorized. invalid role for a given token`)
if role != nil && *role != claimRole {
return res, fmt.Errorf(`unauthorized`)
}
userIdStr := fmt.Sprintf("%v", user.ID)