Documentation ¶
Overview ¶
Package internal contains support packages for oauth2 package.
Package internal contains support packages for oauth2 package.
Package internal contains support packages for oauth2 package.
Index ¶
- func CondVal(v string) []string
- func ContextClient(ctx context.Context) (*http.Client, error)
- func ContextTransport(ctx context.Context) http.RoundTripper
- func ParseINI(ini io.Reader) (map[string]map[string]string, error)
- func ParseKey(key []byte) (*rsa.PrivateKey, error)
- func RegisterBrokenAuthHeaderProvider(tokenURL string)
- func RegisterContextClientFunc(fn ContextClientFunc)
- type ContextClientFunc
- type ContextKey
- type ErrorTransport
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextTransport ¶ added in v1.0.0
func ContextTransport(ctx context.Context) http.RoundTripper
func ParseKey ¶
func ParseKey(key []byte) (*rsa.PrivateKey, error)
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.
func RegisterBrokenAuthHeaderProvider ¶ added in v1.0.0
func RegisterBrokenAuthHeaderProvider(tokenURL string)
func RegisterContextClientFunc ¶ added in v1.0.0
func RegisterContextClientFunc(fn ContextClientFunc)
Types ¶
type ContextClientFunc ¶ added in v1.0.0
ContextClientFunc is a func which tries to return an *http.Client given a Context value. If it returns an error, the search stops with that error. If it returns (nil, nil), the search continues down the list of registered funcs.
type ContextKey ¶ added in v1.0.0
type ContextKey struct{}
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 ContextKey
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.
type ErrorTransport ¶ added in v1.0.0
type ErrorTransport struct{ Err error }
ErrorTransport returns the specified error on RoundTrip. This RoundTripper should be used in rare error cases where error handling can be postponed to response handling time.
type Token ¶ added in v1.0.0
type Token struct { // AccessToken is the token that authorizes and authenticates // the requests. AccessToken string // TokenType is the type of token. // The Type method returns either this or "Bearer", the default. TokenType string // RefreshToken is a token that's used by the application // (as opposed to the user) to refresh the access token // if it expires. RefreshToken string // 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. Expiry time.Time // Raw optionally contains extra metadata from the server // when updating a token. Raw interface{} }
Token represents the crendentials 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.