Skip to content

Commit

Permalink
replaced username with user_id (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartendeKruijf authored May 21, 2024
1 parent 1d96431 commit 6b413ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions test/integration/capability/http/http_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ func TestHttpOAuth2(t *testing.T) {
func TestHttpBasicAuth(t *testing.T) {
request := httpUtil.HttpRequest{}
httpCapability := http.New(&request)
username := "test"
user_id := "test"
password := "password"
url := fmt.Sprintf("https://httpbin.org/basic-auth/%s/%s", username, password)
url := fmt.Sprintf("https://httpbin.org/basic-auth/%s/%s", user_id, password)

target := cacao.AgentTarget{
Address: map[cacao.NetAddressType][]string{
Expand All @@ -109,7 +109,7 @@ func TestHttpBasicAuth(t *testing.T) {

auth := cacao.AuthenticationInformation{
Type: cacao.AuthInfoHTTPBasicType,
Username: username,
UserId: user_id,
Password: password,
ID: "d0c7e6a0-f7fe-464e-9935-e6b3443f5b91",
}
Expand Down
8 changes: 4 additions & 4 deletions test/unittest/utils/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ func TestHttpBearerToken(t *testing.T) {
}

func TestHttpBasicAuth(t *testing.T) {
username := "test"
user_id := "test"
password := "password"
url := fmt.Sprintf("https://httpbin.org/basic-auth/%s/%s", username, password)
url := fmt.Sprintf("https://httpbin.org/basic-auth/%s/%s", user_id, password)
httpRequest := http.HttpRequest{}

target := cacao.AgentTarget{
Expand All @@ -228,7 +228,7 @@ func TestHttpBasicAuth(t *testing.T) {

auth := cacao.AuthenticationInformation{
Type: cacao.AuthInfoHTTPBasicType,
Username: username,
UserId: user_id,
Password: password,
ID: "d0c7e6a0-f7fe-464e-9935-e6b3443f5b91",
}
Expand Down Expand Up @@ -258,7 +258,7 @@ func TestHttpBasicAuth(t *testing.T) {
}

assert.Equal(t, authResponse.Authenticated, true)
assert.Equal(t, authResponse.User, username)
assert.Equal(t, authResponse.User, user_id)
}

func TestHttpPostWithContentConnection(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion utils/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (httpOptions *HttpOptions) addAuthTo(request *http.Request) error {

switch authInfoType {
case cacao.AuthInfoHTTPBasicType:
request.SetBasicAuth(httpOptions.Auth.Username, httpOptions.Auth.Password)
request.SetBasicAuth(httpOptions.Auth.UserId, httpOptions.Auth.Password)
case cacao.AuthInfoOAuth2Type:
bearer := fmt.Sprintf("Bearer %s", httpOptions.Auth.Token)
request.Header.Add("Authorization", bearer)
Expand Down

0 comments on commit 6b413ec

Please sign in to comment.