]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/golang.org/x/oauth2/google/appengine.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / golang.org / x / oauth2 / google / appengine.go
1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package google
6
7 import (
8 "context"
9 "time"
10
11 "golang.org/x/oauth2"
12 )
13
14 // Set at init time by appengine_gen1.go. If nil, we're not on App Engine standard first generation (<= Go 1.9) or App Engine flexible.
15 var appengineTokenFunc func(c context.Context, scopes ...string) (token string, expiry time.Time, err error)
16
17 // Set at init time by appengine_gen1.go. If nil, we're not on App Engine standard first generation (<= Go 1.9) or App Engine flexible.
18 var appengineAppIDFunc func(c context.Context) string
19
20 // AppEngineTokenSource returns a token source that fetches tokens from either
21 // the current application's service account or from the metadata server,
22 // depending on the App Engine environment. See below for environment-specific
23 // details. If you are implementing a 3-legged OAuth 2.0 flow on App Engine that
24 // involves user accounts, see oauth2.Config instead.
25 //
26 // First generation App Engine runtimes (<= Go 1.9):
27 // AppEngineTokenSource returns a token source that fetches tokens issued to the
28 // current App Engine application's service account. The provided context must have
29 // come from appengine.NewContext.
30 //
31 // Second generation App Engine runtimes (>= Go 1.11) and App Engine flexible:
32 // AppEngineTokenSource is DEPRECATED on second generation runtimes and on the
33 // flexible environment. It delegates to ComputeTokenSource, and the provided
34 // context and scopes are not used. Please use DefaultTokenSource (or ComputeTokenSource,
35 // which DefaultTokenSource will use in this case) instead.
36 func AppEngineTokenSource(ctx context.Context, scope ...string) oauth2.TokenSource {
37 return appEngineTokenSource(ctx, scope...)
38 }