mirror of
https://github.com/rclone/rclone.git
synced 2025-08-18 09:30:03 +02:00
vendor: update all dependencies
This commit is contained in:
16
vendor/golang.org/x/oauth2/cern/cern.go
generated
vendored
Normal file
16
vendor/golang.org/x/oauth2/cern/cern.go
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package cern provides constants for using OAuth2 to access CERN services.
|
||||
package cern // import "golang.org/x/oauth2/cern"
|
||||
|
||||
import (
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
// Endpoint is CERN's OAuth 2.0 endpoint.
|
||||
var Endpoint = oauth2.Endpoint{
|
||||
AuthURL: "https://oauth.web.cern.ch/OAuth/Authorize",
|
||||
TokenURL: "https://oauth.web.cern.ch/OAuth/Token",
|
||||
}
|
16
vendor/golang.org/x/oauth2/gitlab/gitlab.go
generated
vendored
Normal file
16
vendor/golang.org/x/oauth2/gitlab/gitlab.go
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package gitlab provides constants for using OAuth2 to access GitLab.
|
||||
package gitlab // import "golang.org/x/oauth2/gitlab"
|
||||
|
||||
import (
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
// Endpoint is GitLab's OAuth 2.0 endpoint.
|
||||
var Endpoint = oauth2.Endpoint{
|
||||
AuthURL: "https://gitlab.com/oauth/authorize",
|
||||
TokenURL: "https://gitlab.com/oauth/token",
|
||||
}
|
16
vendor/golang.org/x/oauth2/kakao/kakao.go
generated
vendored
Normal file
16
vendor/golang.org/x/oauth2/kakao/kakao.go
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package kakao provides constants for using OAuth2 to access Kakao.
|
||||
package kakao // import "golang.org/x/oauth2/kakao"
|
||||
|
||||
import (
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
// Endpoint is Kakao's OAuth 2.0 endpoint.
|
||||
var Endpoint = oauth2.Endpoint{
|
||||
AuthURL: "https://kauth.kakao.com/oauth/authorize",
|
||||
TokenURL: "https://kauth.kakao.com/oauth/token",
|
||||
}
|
4
vendor/golang.org/x/oauth2/linkedin/linkedin.go
generated
vendored
4
vendor/golang.org/x/oauth2/linkedin/linkedin.go
generated
vendored
@@ -11,6 +11,6 @@ import (
|
||||
|
||||
// Endpoint is LinkedIn's OAuth 2.0 endpoint.
|
||||
var Endpoint = oauth2.Endpoint{
|
||||
AuthURL: "https://www.linkedin.com/uas/oauth2/authorization",
|
||||
TokenURL: "https://www.linkedin.com/uas/oauth2/accessToken",
|
||||
AuthURL: "https://www.linkedin.com/oauth/v2/authorization",
|
||||
TokenURL: "https://www.linkedin.com/oauth/v2/accessToken",
|
||||
}
|
||||
|
3
vendor/golang.org/x/oauth2/oauth2.go
generated
vendored
3
vendor/golang.org/x/oauth2/oauth2.go
generated
vendored
@@ -3,7 +3,8 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package oauth2 provides support for making
|
||||
// OAuth2 authorized and authenticated HTTP requests.
|
||||
// OAuth2 authorized and authenticated HTTP requests,
|
||||
// as specified in RFC 6749.
|
||||
// It can additionally grant authorization with Bearer JWT.
|
||||
package oauth2 // import "golang.org/x/oauth2"
|
||||
|
||||
|
16
vendor/golang.org/x/oauth2/transport.go
generated
vendored
16
vendor/golang.org/x/oauth2/transport.go
generated
vendored
@@ -31,9 +31,17 @@ type Transport struct {
|
||||
}
|
||||
|
||||
// RoundTrip authorizes and authenticates the request with an
|
||||
// access token. If no token exists or token is expired,
|
||||
// tries to refresh/fetch a new token.
|
||||
// access token from Transport's Source.
|
||||
func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
reqBodyClosed := false
|
||||
if req.Body != nil {
|
||||
defer func() {
|
||||
if !reqBodyClosed {
|
||||
req.Body.Close()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
if t.Source == nil {
|
||||
return nil, errors.New("oauth2: Transport's Source is nil")
|
||||
}
|
||||
@@ -46,6 +54,10 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
token.SetAuthHeader(req2)
|
||||
t.setModReq(req, req2)
|
||||
res, err := t.base().RoundTrip(req2)
|
||||
|
||||
// req.Body is assumed to have been closed by the base RoundTripper.
|
||||
reqBodyClosed = true
|
||||
|
||||
if err != nil {
|
||||
t.setModReq(req, nil)
|
||||
return nil, err
|
||||
|
60
vendor/golang.org/x/oauth2/transport_test.go
generated
vendored
60
vendor/golang.org/x/oauth2/transport_test.go
generated
vendored
@@ -1,6 +1,8 @@
|
||||
package oauth2
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
@@ -27,6 +29,64 @@ func TestTransportNilTokenSource(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
type readCloseCounter struct {
|
||||
CloseCount int
|
||||
ReadErr error
|
||||
}
|
||||
|
||||
func (r *readCloseCounter) Read(b []byte) (int, error) {
|
||||
return 0, r.ReadErr
|
||||
}
|
||||
|
||||
func (r *readCloseCounter) Close() error {
|
||||
r.CloseCount++
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestTransportCloseRequestBody(t *testing.T) {
|
||||
tr := &Transport{}
|
||||
server := newMockServer(func(w http.ResponseWriter, r *http.Request) {})
|
||||
defer server.Close()
|
||||
client := &http.Client{Transport: tr}
|
||||
body := &readCloseCounter{
|
||||
ReadErr: errors.New("readCloseCounter.Read not implemented"),
|
||||
}
|
||||
resp, err := client.Post(server.URL, "application/json", body)
|
||||
if err == nil {
|
||||
t.Errorf("got no errors, want an error with nil token source")
|
||||
}
|
||||
if resp != nil {
|
||||
t.Errorf("Response = %v; want nil", resp)
|
||||
}
|
||||
if expected := 1; body.CloseCount != expected {
|
||||
t.Errorf("Body was closed %d times, expected %d", body.CloseCount, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTransportCloseRequestBodySuccess(t *testing.T) {
|
||||
tr := &Transport{
|
||||
Source: StaticTokenSource(&Token{
|
||||
AccessToken: "abc",
|
||||
}),
|
||||
}
|
||||
server := newMockServer(func(w http.ResponseWriter, r *http.Request) {})
|
||||
defer server.Close()
|
||||
client := &http.Client{Transport: tr}
|
||||
body := &readCloseCounter{
|
||||
ReadErr: io.EOF,
|
||||
}
|
||||
resp, err := client.Post(server.URL, "application/json", body)
|
||||
if err != nil {
|
||||
t.Errorf("got error %v; expected none", err)
|
||||
}
|
||||
if resp == nil {
|
||||
t.Errorf("Response is nil; expected non-nil")
|
||||
}
|
||||
if expected := 1; body.CloseCount != expected {
|
||||
t.Errorf("Body was closed %d times, expected %d", body.CloseCount, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTransportTokenSource(t *testing.T) {
|
||||
ts := &tokenSource{
|
||||
token: &Token{
|
||||
|
4
vendor/golang.org/x/oauth2/twitch/twitch.go
generated
vendored
4
vendor/golang.org/x/oauth2/twitch/twitch.go
generated
vendored
@@ -14,6 +14,6 @@ import (
|
||||
// For more information see:
|
||||
// https://dev.twitch.tv/docs/authentication
|
||||
var Endpoint = oauth2.Endpoint{
|
||||
AuthURL: "https://api.twitch.tv/kraken/oauth2/authorize",
|
||||
TokenURL: "https://api.twitch.tv/kraken/oauth2/token",
|
||||
AuthURL: "https://id.twitch.tv/oauth2/authorize",
|
||||
TokenURL: "https://id.twitch.tv/oauth2/token",
|
||||
}
|
||||
|
Reference in New Issue
Block a user