mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 18:52:25 -05:00 
			
		
		
		
	[chore]: Bump golang.org/x/oauth2 from 0.6.0 to 0.7.0 (#1684)
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.6.0 to 0.7.0. - [Release notes](https://github.com/golang/oauth2/releases) - [Commits](https://github.com/golang/oauth2/compare/v0.6.0...v0.7.0) --- updated-dependencies: - dependency-name: golang.org/x/oauth2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
		
					parent
					
						
							
								1d8f9c6b16
							
						
					
				
			
			
				commit
				
					
						c01d2f9b44
					
				
			
		
					 6 changed files with 56 additions and 11 deletions
				
			
		
							
								
								
									
										33
									
								
								vendor/golang.org/x/oauth2/oauth2.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								vendor/golang.org/x/oauth2/oauth2.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -16,6 +16,7 @@ import ( | |||
| 	"net/url" | ||||
| 	"strings" | ||||
| 	"sync" | ||||
| 	"time" | ||||
| 
 | ||||
| 	"golang.org/x/oauth2/internal" | ||||
| ) | ||||
|  | @ -140,7 +141,7 @@ func SetAuthURLParam(key, value string) AuthCodeOption { | |||
| // | ||||
| // State is a token to protect the user from CSRF attacks. You must | ||||
| // always provide a non-empty string and validate that it matches the | ||||
| // the state query parameter on your redirect callback. | ||||
| // state query parameter on your redirect callback. | ||||
| // See http://tools.ietf.org/html/rfc6749#section-10.12 for more info. | ||||
| // | ||||
| // Opts may include AccessTypeOnline or AccessTypeOffline, as well | ||||
|  | @ -290,6 +291,8 @@ type reuseTokenSource struct { | |||
| 
 | ||||
| 	mu sync.Mutex // guards t | ||||
| 	t  *Token | ||||
| 
 | ||||
| 	expiryDelta time.Duration | ||||
| } | ||||
| 
 | ||||
| // Token returns the current token if it's still valid, else will | ||||
|  | @ -305,6 +308,7 @@ func (s *reuseTokenSource) Token() (*Token, error) { | |||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	t.expiryDelta = s.expiryDelta | ||||
| 	s.t = t | ||||
| 	return t, nil | ||||
| } | ||||
|  | @ -379,3 +383,30 @@ func ReuseTokenSource(t *Token, src TokenSource) TokenSource { | |||
| 		new: src, | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // ReuseTokenSource returns a TokenSource that acts in the same manner as the | ||||
| // TokenSource returned by ReuseTokenSource, except the expiry buffer is | ||||
| // configurable. The expiration time of a token is calculated as | ||||
| // t.Expiry.Add(-earlyExpiry). | ||||
| func ReuseTokenSourceWithExpiry(t *Token, src TokenSource, earlyExpiry time.Duration) TokenSource { | ||||
| 	// Don't wrap a reuseTokenSource in itself. That would work, | ||||
| 	// but cause an unnecessary number of mutex operations. | ||||
| 	// Just build the equivalent one. | ||||
| 	if rt, ok := src.(*reuseTokenSource); ok { | ||||
| 		if t == nil { | ||||
| 			// Just use it directly, but set the expiryDelta to earlyExpiry, | ||||
| 			// so the behavior matches what the user expects. | ||||
| 			rt.expiryDelta = earlyExpiry | ||||
| 			return rt | ||||
| 		} | ||||
| 		src = rt.new | ||||
| 	} | ||||
| 	if t != nil { | ||||
| 		t.expiryDelta = earlyExpiry | ||||
| 	} | ||||
| 	return &reuseTokenSource{ | ||||
| 		t:           t, | ||||
| 		new:         src, | ||||
| 		expiryDelta: earlyExpiry, | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue