in whisk/client.go [327:345]
func (c *Client) addAuthHeader(req *http.Request, authRequired bool) error {
// Allow for authorization override via Additional Headers
authHeaderValue := c.Config.AdditionalHeaders.Get("Authorization")
if authHeaderValue != "" {
Debug(DbgInfo, "Using additional header authorization\n")
} else if c.Config.AuthToken != "" {
encodedAuthToken := base64.StdEncoding.EncodeToString([]byte(c.Config.AuthToken))
req.Header.Add("Authorization", fmt.Sprintf("Basic %s", encodedAuthToken))
Debug(DbgInfo, "Adding basic auth header; using authkey\n")
} else {
if authRequired {
Debug(DbgError, "The required authorization key is not configured - neither set as a property nor set via the --auth CLI argument\n")
errStr := wski18n.T("Authorization key is not configured (--auth is required)")
werr := MakeWskError(errors.New(errStr), EXIT_CODE_ERR_USAGE, DISPLAY_MSG, DISPLAY_USAGE)
return werr
}
}
return nil
}