ContextKey is just an empty struct. It exists so HTTPClient can be
an immutable public variable with a unique type. It's immutable
because nobody else can create a ContextKey, being unexported.
var HTTPClient
var golang.org/x/oauth2.HTTPClient
Token represents the credentials used to authorize
the requests to access protected resources on the OAuth 2.0
provider's backend.
This type is a mirror of oauth2.Token and exists to break
an otherwise-circular dependency. Other internal packages
should convert this Token into an oauth2.Token before use.
AccessToken is the token that authorizes and authenticates
the requests.
Expiry is the optional expiration time of the access token.
If zero, TokenSource implementations will reuse the same
token forever and RefreshToken or equivalent
mechanisms for that TokenSource will not be used.
Raw optionally contains extra metadata from the server
when updating a token.
RefreshToken is a token that's used by the application
(as opposed to the user) to refresh the access token
if it expires.
TokenType is the type of token.
The Type method returns either this or "Bearer", the default.
func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string, v url.Values, authStyle AuthStyle) (*Token, error)
func doTokenRoundTrip(ctx context.Context, req *http.Request) (*Token, error)
func golang.org/x/oauth2.tokenFromInternal(t *Token) *oauth2.Token
ParseKey converts the binary contents of a private key file
to an *rsa.PrivateKey. It detects whether the private key is in a
PEM container or not. If so, it extracts the the private key
from PEM container before conversion. It only supports PEM
containers with no passphrase.
RegisterBrokenAuthHeaderProvider previously did something. It is now a no-op.
Deprecated: this function no longer does anything. Caller code that
wants to avoid potential extra HTTP requests made during
auto-probing of the provider's auth style should set
Endpoint.AuthStyle.
ResetAuthCache resets the global authentication style cache used
for AuthStyleUnknown token requests.
lookupAuthStyle reports which auth style we last used with tokenURL
when calling RetrieveToken and whether we have ever done so.
newTokenRequest returns a new *http.Request to retrieve a new token
from tokenURL using the provided clientID, clientSecret, and POST
body parameters.
inParams is whether the clientID & clientSecret should be encoded
as the POST body. An 'inParams' value of true means to send it in
the POST body (along with any values in v); false means to send it
in the Authorization header.
setAuthStyle adds an entry to authStyleCache, documented above.
Package-Level Variables (total 3, in which 1 are exported)
HTTPClient is the context key to use with golang.org/x/net/context's
WithValue function to associate an *http.Client value with a context.
authStyleCache is the set of tokenURLs we've successfully used via
RetrieveToken and which style auth we ended up using.
It's called a cache, but it doesn't (yet?) shrink. It's expected that
the set of OAuth2 servers a program contacts over time is fixed and
small.
Package-Level Constants (total 3, all are exported)
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.