Skip to content

Commit

Permalink
Added logging of auth error in http util (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartendeKruijf authored Sep 6, 2024
1 parent c7d2a47 commit 9861f79
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (httpRequest *HttpOptions) handleResponse(response *http.Response) ([]byte,
func verifyAuthInfoMatchesAgentTarget(
target *cacao.AgentTarget, authInfo *cacao.AuthenticationInformation,
) error {
log.Trace("target id: ", target.AuthInfoIdentifier, " auth info object id: ", authInfo.ID)
if target.AuthInfoIdentifier == "" || authInfo.ID == "" {
return errors.New("target target.AuthInfoIndentifier or authInfo.ID is empty")
}
Expand All @@ -163,6 +164,7 @@ func (httpOptions *HttpOptions) addAuthTo(request *http.Request) error {
return nil
}
if err := verifyAuthInfoMatchesAgentTarget(httpOptions.Target, httpOptions.Auth); err != nil {
log.Error(err)
return errors.New("auth info does not match target Id")
}

Expand Down

0 comments on commit 9861f79

Please sign in to comment.