Skip to content

Commit 57304e1

Browse files
committed
removed unnecessary response code checks
1 parent f5f1bc8 commit 57304e1

File tree

3 files changed

+0
-22
lines changed

3 files changed

+0
-22
lines changed

iam_blob.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"encoding/base64"
66
"fmt"
7-
"net/http"
87

98
"github.com/dgrijalva/jwt-go"
109
"google.golang.org/api/iam/v1"
@@ -40,11 +39,6 @@ func signBlob(ctx context.Context, iamService *iam.Service, config *IAMConfig, s
4039
return "", err
4140
}
4241

43-
// Check the response
44-
if signResp.HTTPStatusCode != http.StatusOK {
45-
return "", fmt.Errorf("unexpected response code from signing request, expected %d but got %d instead", http.StatusOK, signResp.HTTPStatusCode)
46-
}
47-
4842
config.lastKeyID = signResp.KeyId
4943

5044
signature, err := base64.StdEncoding.DecodeString(signResp.Signature)

iam_jwt.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package gcpjwt
33
import (
44
"context"
55
"fmt"
6-
"net/http"
76
"strings"
87

98
"github.com/dgrijalva/jwt-go"
@@ -48,11 +47,6 @@ func signJwt(ctx context.Context, iamService *iam.Service, config *IAMConfig, si
4847
return "", err
4948
}
5049

51-
// Check the response
52-
if signResp.HTTPStatusCode != http.StatusOK {
53-
return "", fmt.Errorf("gcpjwt: expected response code `%d` from signing request, got `%d`", http.StatusOK, signResp.HTTPStatusCode)
54-
}
55-
5650
config.lastKeyID = signResp.KeyId
5751

5852
return signResp.SignedJwt, nil

kms.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"encoding/pem"
1010
"fmt"
1111
"math/big"
12-
"net/http"
1312

1413
"github.com/dgrijalva/jwt-go"
1514
"google.golang.org/api/cloudkms/v1"
@@ -181,10 +180,6 @@ func KMSVerfiyKeyfunc(ctx context.Context, config *KMSConfig) (jwt.Keyfunc, erro
181180
return nil, err
182181
}
183182

184-
if response.HTTPStatusCode != http.StatusOK {
185-
return nil, fmt.Errorf("gcpjwt: expected response code `%d` from signing request, got `%d`", http.StatusOK, response.HTTPStatusCode)
186-
}
187-
188183
keyBytes := []byte(response.Pem)
189184
block, _ := pem.Decode(keyBytes)
190185
if block == nil {
@@ -241,11 +236,6 @@ func signKMS(ctx context.Context, config *KMSConfig, request *cloudkms.Asymmetri
241236
return "", err
242237
}
243238

244-
// Check the response
245-
if signResp.HTTPStatusCode != http.StatusOK {
246-
return "", fmt.Errorf("gcpjwt: expected response code `%d` from signing request, got `%d`", http.StatusOK, signResp.HTTPStatusCode)
247-
}
248-
249239
// Decode the response
250240
decodedSignature, err := base64.StdEncoding.DecodeString(signResp.Signature)
251241
if err != nil {

0 commit comments

Comments
 (0)