Don't use repo to check impossible token requests and repo doesn't return error on token value mismatch. (#171)

* Remove error when tokens mismatch from public id but log returned errors from repo.
pull/175/head
Todd Knight 6 years ago committed by GitHub
parent 4decf9502a
commit 2ce9affeea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -210,7 +210,7 @@ func (r *Repository) ValidateToken(ctx context.Context, id, token string, opt ..
}
if retAT.GetToken() != token {
return nil, fmt.Errorf("validate token: auth token mismatch: %w", db.ErrInvalidParameter)
return nil, nil
}
// retAT.Token set to empty string so the value is not returned as described in the methods' doc.
retAT.Token = ""

@ -43,6 +43,10 @@ func TokenAuthenticator(l hclog.Logger, tokenRepo common.AuthTokenRepoFactory) f
}
}
if tMD.recievedTokenType == authTokenTypeUnknown || tMD.token() == "" || tMD.publicId() == "" {
return tMD.toMetadata()
}
repo, err := tokenRepo()
if err != nil {
l.Error("failed to get authtoken repo", "error", err)

Loading…
Cancel
Save