forked from Mirrors/oauth2
all: remove redundant type conversion
Signed-off-by: cui fliter <imcusg@gmail.com>
This commit is contained in:
parent
0ebed06d00
commit
4e40ee8059
|
@ -73,7 +73,7 @@ func TestJWTAccessTokenSourceFromJSON(t *testing.T) {
|
||||||
t.Fatalf("base64 DecodeString: %v\nString: %q", err, parts[0])
|
t.Fatalf("base64 DecodeString: %v\nString: %q", err, parts[0])
|
||||||
}
|
}
|
||||||
var hdr jws.Header
|
var hdr jws.Header
|
||||||
if err := json.Unmarshal([]byte(hdrJSON), &hdr); err != nil {
|
if err := json.Unmarshal(hdrJSON, &hdr); err != nil {
|
||||||
t.Fatalf("json.Unmarshal: %v (%q)", err, hdrJSON)
|
t.Fatalf("json.Unmarshal: %v (%q)", err, hdrJSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ func TestJWTAccessTokenSourceWithScope(t *testing.T) {
|
||||||
t.Fatalf("base64 DecodeString: %v\nString: %q", err, parts[0])
|
t.Fatalf("base64 DecodeString: %v\nString: %q", err, parts[0])
|
||||||
}
|
}
|
||||||
var hdr jws.Header
|
var hdr jws.Header
|
||||||
if err := json.Unmarshal([]byte(hdrJSON), &hdr); err != nil {
|
if err := json.Unmarshal(hdrJSON, &hdr); err != nil {
|
||||||
t.Fatalf("json.Unmarshal: %v (%q)", err, hdrJSON)
|
t.Fatalf("json.Unmarshal: %v (%q)", err, hdrJSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ func (js jwtSource) Token() (*oauth2.Token, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
v.Set("assertion", string(assertion))
|
v.Set("assertion", assertion)
|
||||||
|
|
||||||
// Fetch access token from auth server
|
// Fetch access token from auth server
|
||||||
hc := oauth2.NewClient(js.ctx, nil)
|
hc := oauth2.NewClient(js.ctx, nil)
|
||||||
|
|
|
@ -178,5 +178,5 @@ func Verify(token string, key *rsa.PublicKey) error {
|
||||||
|
|
||||||
h := sha256.New()
|
h := sha256.New()
|
||||||
h.Write([]byte(signedContent))
|
h.Write([]byte(signedContent))
|
||||||
return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), []byte(signatureString))
|
return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), signatureString)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue