File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ import (
24
24
"io"
25
25
"net/http"
26
26
"net/url"
27
- "path"
28
27
"strings"
29
28
"time"
30
29
@@ -101,12 +100,19 @@ func newExchanger(endpoint string) *exchanger {
101
100
// ExchangeACRAccessToken exchanges an access token for a refresh token with the
102
101
// exchange service.
103
102
func (e * exchanger ) ExchangeACRAccessToken (armToken string ) (string , error ) {
103
+ // This hack is required because the net/url package does not recognize
104
+ // a hostname unless the scheme is also present and it includes the
105
+ // entire hostname in the path as well.
106
+ if ! strings .HasPrefix (e .endpoint , "https://" ) {
107
+ e .endpoint = fmt .Sprintf ("https://%s" , e .endpoint )
108
+ }
109
+
104
110
// Construct the exchange URL.
105
111
exchangeURL , err := url .Parse (e .endpoint )
106
112
if err != nil {
107
113
return "" , err
108
114
}
109
- exchangeURL .Path = path . Join ( exchangeURL . Path , "oauth2/exchange" )
115
+ exchangeURL .Path = "oauth2/exchange"
110
116
111
117
parameters := url.Values {}
112
118
parameters .Add ("grant_type" , "access_token" )
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
20
20
"context"
21
21
22
22
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
23
+ _ "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime"
23
24
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
24
25
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
25
26
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
You can’t perform that action at this time.
0 commit comments