mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
SMQ-3415 - Return correct error in auth gRPC response (#3416)
Signed-off-by: Arvindh <arvindh91@gmail.com>
This commit is contained in:
+1
-1
@@ -331,7 +331,7 @@ func (svc service) invitationKey(ctx context.Context, key Key) (Token, error) {
|
||||
func (svc service) refreshKey(ctx context.Context, token string, key Key) (Token, error) {
|
||||
k, err := svc.tokenizer.Parse(ctx, token)
|
||||
if err != nil {
|
||||
return Token{}, errors.Wrap(errRetrieve, err)
|
||||
return Token{}, errors.Wrap(svcerr.ErrAuthentication, err)
|
||||
}
|
||||
if k.Type != RefreshKey {
|
||||
return Token{}, errIssueUser
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"github.com/absmach/magistrala/auth"
|
||||
smqjwt "github.com/absmach/magistrala/auth/tokenizer/util"
|
||||
"github.com/absmach/magistrala/pkg/errors"
|
||||
svcerr "github.com/absmach/magistrala/pkg/errors/service"
|
||||
"github.com/lestrrat-go/jwx/v2/jwa"
|
||||
"github.com/lestrrat-go/jwx/v2/jwt"
|
||||
)
|
||||
@@ -61,9 +60,9 @@ func (tok *tokenizer) Parse(ctx context.Context, tokenString string) (auth.Key,
|
||||
)
|
||||
if err != nil {
|
||||
if errors.Contains(err, smqjwt.ErrJWTExpiryKey) {
|
||||
return auth.Key{}, errors.Wrap(svcerr.ErrAuthentication, auth.ErrExpiry)
|
||||
return auth.Key{}, auth.ErrExpiry
|
||||
}
|
||||
return auth.Key{}, errors.Wrap(svcerr.ErrAuthentication, err)
|
||||
return auth.Key{}, err
|
||||
}
|
||||
|
||||
if tkn.Issuer() != smqjwt.IssuerName {
|
||||
|
||||
Reference in New Issue
Block a user