Skip to content

Commit

Permalink
Fix x-ms-authorization-auxiliary header sperator to comma (#521)
Browse files Browse the repository at this point in the history
* auxTokens should be joined with comma

* Update CHANGELOG.md

* Clean up PR and fix CI

* Update tests

Co-authored-by: Joel Hendrix <[email protected]>
  • Loading branch information
yuwzho and jhendrixMSFT authored May 21, 2020
1 parent 9132adf commit 778ae56
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## v14.1.1

### Bug Fixes

- Change `x-ms-authorization-auxiliary` header value separator to comma.

## v14.1.0

### New Features
Expand Down
2 changes: 1 addition & 1 deletion autorest/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func (mt multiTenantSPTAuthorizer) WithAuthorization() PrepareDecorator {
for i := range auxTokens {
auxTokens[i] = fmt.Sprintf("Bearer %s", auxTokens[i])
}
return Prepare(r, WithHeader(headerAuxAuthorization, strings.Join(auxTokens, "; ")))
return Prepare(r, WithHeader(headerAuxAuthorization, strings.Join(auxTokens, ", ")))
})
}
}
4 changes: 2 additions & 2 deletions autorest/authorization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func TestMultitenantAuthorizationThree(t *testing.T) {
if primary := req.Header.Get(headerAuthorization); primary != "Bearer primary" {
t.Fatalf("bad primary authorization header %s", primary)
}
if aux := req.Header.Get(headerAuxAuthorization); aux != "Bearer aux1; Bearer aux2; Bearer aux3" {
if aux := req.Header.Get(headerAuxAuthorization); aux != "Bearer aux1, Bearer aux2, Bearer aux3" {
t.Fatalf("bad auxiliary authorization header %s", aux)
}
}
Expand Down Expand Up @@ -376,7 +376,7 @@ func TestMultiTenantServicePrincipalTokenWithAuthorizationRefresh(t *testing.T)
auxTokens[i] = fmt.Sprintf("Bearer %s", auxTokens[i])
}
auxHeader := req.Header.Get(http.CanonicalHeaderKey(headerAuxAuthorization))
if auxHeader != strings.Join(auxTokens, "; ") {
if auxHeader != strings.Join(auxTokens, ", ") {
t.Fatal("azure: multiTenantSPTAuthorizer#WithAuthorization failed to set Authorization header for auxiliary tokens")
}
for i := range auxTokens {
Expand Down
2 changes: 1 addition & 1 deletion autorest/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"runtime"
)

const number = "v14.1.0"
const number = "v14.1.1"

var (
userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s",
Expand Down
8 changes: 5 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@ jobs:
Linux_Go113:
vm.image: 'ubuntu-18.04'
go.version: '1.13'
GOROOT: '/usr/local/go$(go.version)'
Linux_Go114:
vm.image: 'ubuntu-18.04'
go.version: '1.14'
GOROOT: '/usr/local/go$(go.version)'

pool:
vmImage: '$(vm.image)'

steps:
- task: GoTool@0
inputs:
version: '$(go.version)'
displayName: "Select Go Version"

- script: |
set -e
mkdir -p '$(GOPATH)/bin'
mkdir -p '$(sdkPath)'
shopt -s extglob
mv !(work) '$(sdkPath)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
echo '##vso[task.prependpath]$(GOPATH)/bin'
displayName: 'Create Go Workspace'
Expand Down

0 comments on commit 778ae56

Please sign in to comment.