Skip to content

Commit 92adc45

Browse files
committedFeb 11, 2025
fix: Drop operationID soap header for unsupported endpoints
This soap header is unused by lookup, ssoadmin and sts endpoints. - Avoids an error with endpoints using newer jaxws versions: "SAAJ0131: HeaderElements must be namespace qualified" - Quote the sts SoapAction, avoiding warning in the sts logs: "Received WS-I BP non-conformant Unquoted SoapAction HTTP header" Signed-off-by: Doug MacEachern <dougm@broadcom.com>
1 parent 8df8254 commit 92adc45

File tree

3 files changed

+21
-35
lines changed

3 files changed

+21
-35
lines changed
 

‎lookup/client.go

+10-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
/*
2-
Copyright (c) 2018 VMware, Inc. All Rights Reserved.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
1+
// © Broadcom. All Rights Reserved.
2+
// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
3+
// SPDX-License-Identifier: Apache-2.0
164

175
package lookup
186

@@ -73,21 +61,26 @@ func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) {
7361

7462
sc := c.Client.NewServiceClient(path.String(), Namespace)
7563
sc.Version = Version
64+
client := &Client{Client: sc, RoundTripper: sc}
7665

7766
req := types.RetrieveServiceContent{
7867
This: ServiceInstance,
7968
}
8069

81-
res, err := methods.RetrieveServiceContent(ctx, sc, &req)
70+
res, err := methods.RetrieveServiceContent(ctx, client, &req)
8271
if err != nil {
8372
return nil, err
8473
}
8574

86-
return &Client{sc, sc, res.Returnval}, nil
75+
client.ServiceContent = res.Returnval
76+
77+
return client, nil
8778
}
8879

8980
// RoundTrip dispatches to the RoundTripper field.
9081
func (c *Client) RoundTrip(ctx context.Context, req, res soap.HasFault) error {
82+
// Drop any operationID header, not used by lookup service
83+
ctx = context.WithValue(ctx, vim.ID{}, "")
9184
return c.RoundTripper.RoundTrip(ctx, req, res)
9285
}
9386

‎ssoadmin/client.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) {
9999
This: ServiceInstance,
100100
}
101101

102-
res, err := methods.SsoAdminServiceInstance(ctx, sc, &req)
102+
res, err := methods.SsoAdminServiceInstance(ctx, admin, &req)
103103
if err != nil {
104104
return nil, err
105105
}
@@ -114,7 +114,7 @@ func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) {
114114
},
115115
}
116116

117-
res, err := methods.SsoGroupcheckServiceInstance(ctx, sc, &req)
117+
res, err := methods.SsoGroupcheckServiceInstance(ctx, admin, &req)
118118
if err != nil {
119119
return nil, err
120120
}
@@ -127,6 +127,8 @@ func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) {
127127

128128
// RoundTrip dispatches to the RoundTripper field.
129129
func (c *Client) RoundTrip(ctx context.Context, req, res soap.HasFault) error {
130+
// Drop any operationID header, not used by ssoadmin
131+
ctx = context.WithValue(ctx, vim.ID{}, "")
130132
return c.RoundTripper.RoundTrip(ctx, req, res)
131133
}
132134

‎sts/client.go

+7-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
/*
2-
Copyright (c) 2018-2024 VMware, Inc. All Rights Reserved.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
1+
// © Broadcom. All Rights Reserved.
2+
// The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
3+
// SPDX-License-Identifier: Apache-2.0
164

175
package sts
186

@@ -30,6 +18,7 @@ import (
3018
"github.com/vmware/govmomi/sts/internal"
3119
"github.com/vmware/govmomi/vim25"
3220
"github.com/vmware/govmomi/vim25/soap"
21+
vim25types "github.com/vmware/govmomi/vim25/types"
3322
)
3423

3524
const (
@@ -84,6 +73,8 @@ func NewClient(ctx context.Context, c *vim25.Client) (*Client, error) {
8473

8574
// RoundTrip dispatches to the RoundTripper field.
8675
func (c *Client) RoundTrip(ctx context.Context, req, res soap.HasFault) error {
76+
// Drop any operationID header, not used by STS
77+
ctx = context.WithValue(ctx, vim25types.ID{}, "")
8778
return c.RoundTripper.RoundTrip(ctx, req, res)
8879
}
8980

@@ -191,7 +182,7 @@ func (c *Client) Issue(ctx context.Context, req TokenRequest) (*Signer, error) {
191182

192183
header := soap.Header{
193184
Security: s,
194-
Action: rst.Action(),
185+
Action: fmt.Sprintf(`"%s"`, rst.Action()),
195186
}
196187

197188
res, err := internal.Issue(c.WithHeader(ctx, header), c, &rst)

0 commit comments

Comments
 (0)
Please sign in to comment.