NOISSUE-Update invalid secret error handling (#1856)
* update invalid secret error handling Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com> * update secret error naming Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com> * update secretError naming Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com> * fix comment Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com> * add empty space in comment Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com> --------- Signed-off-by: ianmuchyri <ianmuchiri8@gmail.com>
This commit is contained in:
parent
1192325a2e
commit
031e0a62f2
|
@ -42,4 +42,7 @@ var (
|
|||
|
||||
// ErrScanMetadata indicates problem with metadata in db.
|
||||
ErrScanMetadata = New("failed to scan metadata in db")
|
||||
|
||||
// ErrWrongSecret indicates a wrong secret was provided.
|
||||
ErrWrongSecret = New("wrong secret")
|
||||
)
|
||||
|
|
|
@ -111,7 +111,7 @@ func (svc service) IssueToken(ctx context.Context, identity, secret string) (jwt
|
|||
return jwt.Token{}, errors.Wrap(errors.ErrAuthentication, err)
|
||||
}
|
||||
if err := svc.hasher.Compare(secret, dbUser.Credentials.Secret); err != nil {
|
||||
return jwt.Token{}, errors.Wrap(errors.ErrAuthentication, err)
|
||||
return jwt.Token{}, errors.Wrap(errors.ErrWrongSecret, err)
|
||||
}
|
||||
|
||||
claims := jwt.Claims{
|
||||
|
@ -315,7 +315,7 @@ func (svc service) UpdateClientSecret(ctx context.Context, token, oldSecret, new
|
|||
return mfclients.Client{}, err
|
||||
}
|
||||
if _, err := svc.IssueToken(ctx, dbClient.Credentials.Identity, oldSecret); err != nil {
|
||||
return mfclients.Client{}, errors.ErrAuthentication
|
||||
return mfclients.Client{}, err
|
||||
}
|
||||
newSecret, err = svc.hasher.Hash(newSecret)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue