You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

476 lines
16 KiB

8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="theme-color" content="#375EAB">
  7. <title>internal - The Go Programming Language</title>
  8. <link type="text/css" rel="stylesheet" href="../../../../../lib/godoc/style.css">
  9. <link rel="stylesheet" href="../../../../../lib/godoc/jquery.treeview.css">
  10. <script type="text/javascript">window.initFuncs = [];</script>
  11. </head>
  12. <body>
  13. <div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
  14. ...
  15. </div><!-- #lowframe -->
  16. <div id="topbar" class="wide"><div class="container">
  17. <div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
  18. <div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
  19. <a href="index.html#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a>
  20. <form method="GET" action="http://localhost:6060/search">
  21. <div id="menu">
  22. <a href="http://localhost:6060/doc/">Documents</a>
  23. <a href="http://localhost:6060/pkg/">Packages</a>
  24. <a href="http://localhost:6060/project/">The Project</a>
  25. <a href="http://localhost:6060/help/">Help</a>
  26. <a href="http://localhost:6060/blog/">Blog</a>
  27. <input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
  28. </div>
  29. </form>
  30. </div></div>
  31. <div id="page" class="wide">
  32. <div class="container">
  33. <h1>Package internal</h1>
  34. <div id="nav"></div>
  35. <!--
  36. Copyright 2009 The Go Authors. All rights reserved.
  37. Use of this source code is governed by a BSD-style
  38. license that can be found in the LICENSE file.
  39. -->
  40. <!--
  41. Note: Static (i.e., not template-generated) href and id
  42. attributes start with "pkg-" to make it impossible for
  43. them to conflict with generated attributes (some of which
  44. correspond to Go identifiers).
  45. -->
  46. <script type='text/javascript'>
  47. document.ANALYSIS_DATA = null;
  48. document.CALLGRAPH = null;
  49. </script>
  50. <div id="short-nav">
  51. <dl>
  52. <dd><code>import "golang.org/x/oauth2/internal"</code></dd>
  53. </dl>
  54. <dl>
  55. <dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
  56. <dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
  57. </dl>
  58. </div>
  59. <!-- The package's Name is printed as title by the top-level template -->
  60. <div id="pkg-overview" class="toggleVisible">
  61. <div class="collapsed">
  62. <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
  63. </div>
  64. <div class="expanded">
  65. <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
  66. <p>
  67. Package internal contains support packages for oauth2 package.
  68. </p>
  69. <p>
  70. Package internal contains support packages for oauth2 package.
  71. </p>
  72. <p>
  73. Package internal contains support packages for oauth2 package.
  74. </p>
  75. </div>
  76. </div>
  77. <div id="pkg-index" class="toggleVisible">
  78. <div class="collapsed">
  79. <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
  80. </div>
  81. <div class="expanded">
  82. <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
  83. <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
  84. <div id="manual-nav">
  85. <dl>
  86. <dd><a href="index.html#CondVal">func CondVal(v string) []string</a></dd>
  87. <dd><a href="index.html#ContextClient">func ContextClient(ctx context.Context) (*http.Client, error)</a></dd>
  88. <dd><a href="index.html#ContextTransport">func ContextTransport(ctx context.Context) http.RoundTripper</a></dd>
  89. <dd><a href="index.html#ParseINI">func ParseINI(ini io.Reader) (map[string]map[string]string, error)</a></dd>
  90. <dd><a href="index.html#ParseKey">func ParseKey(key []byte) (*rsa.PrivateKey, error)</a></dd>
  91. <dd><a href="index.html#RegisterBrokenAuthHeaderProvider">func RegisterBrokenAuthHeaderProvider(tokenURL string)</a></dd>
  92. <dd><a href="index.html#RegisterContextClientFunc">func RegisterContextClientFunc(fn ContextClientFunc)</a></dd>
  93. <dd><a href="index.html#ContextClientFunc">type ContextClientFunc</a></dd>
  94. <dd><a href="index.html#ContextKey">type ContextKey</a></dd>
  95. <dd><a href="index.html#ErrorTransport">type ErrorTransport</a></dd>
  96. <dd>&nbsp; &nbsp; <a href="index.html#ErrorTransport.RoundTrip">func (t ErrorTransport) RoundTrip(*http.Request) (*http.Response, error)</a></dd>
  97. <dd><a href="index.html#Token">type Token</a></dd>
  98. <dd>&nbsp; &nbsp; <a href="index.html#RetrieveToken">func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string, v url.Values) (*Token, error)</a></dd>
  99. </dl>
  100. </div><!-- #manual-nav -->
  101. <h4>Package files</h4>
  102. <p>
  103. <span style="font-size:90%">
  104. <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/oauth2.go">oauth2.go</a>
  105. <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/token.go">token.go</a>
  106. <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/transport.go">transport.go</a>
  107. </span>
  108. </p>
  109. </div><!-- .expanded -->
  110. </div><!-- #pkg-index -->
  111. <div id="pkg-callgraph" class="toggle" style="display: none">
  112. <div class="collapsed">
  113. <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
  114. </div> <!-- .expanded -->
  115. <div class="expanded">
  116. <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
  117. <p>
  118. In the call graph viewer below, each node
  119. is a function belonging to this package
  120. and its children are the functions it
  121. calls&mdash;perhaps dynamically.
  122. </p>
  123. <p>
  124. The root nodes are the entry points of the
  125. package: functions that may be called from
  126. outside the package.
  127. There may be non-exported or anonymous
  128. functions among them if they are called
  129. dynamically from another package.
  130. </p>
  131. <p>
  132. Click a node to visit that function's source code.
  133. From there you can visit its callers by
  134. clicking its declaring <code>func</code>
  135. token.
  136. </p>
  137. <p>
  138. Functions may be omitted if they were
  139. determined to be unreachable in the
  140. particular programs or tests that were
  141. analyzed.
  142. </p>
  143. <!-- Zero means show all package entry points. -->
  144. <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
  145. </div>
  146. </div> <!-- #pkg-callgraph -->
  147. <h2 id="CondVal">func <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/oauth2.go?s=1967:1998#L61">CondVal</a></h2>
  148. <pre>func CondVal(v <a href="../../../../builtin/index.html#string">string</a>) []<a href="../../../../builtin/index.html#string">string</a></pre>
  149. <h2 id="ContextClient">func <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/transport.go?s=1163:1224#L25">ContextClient</a></h2>
  150. <pre>func ContextClient(ctx <a href="../../net/context/index.html">context</a>.<a href="../../net/context/index.html#Context">Context</a>) (*<a href="../../../../net/http/index.html">http</a>.<a href="../../../../net/http/index.html#Client">Client</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  151. <h2 id="ContextTransport">func <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/transport.go?s=1504:1564#L43">ContextTransport</a></h2>
  152. <pre>func ContextTransport(ctx <a href="../../net/context/index.html">context</a>.<a href="../../net/context/index.html#Context">Context</a>) <a href="../../../../net/http/index.html">http</a>.<a href="../../../../net/http/index.html#RoundTripper">RoundTripper</a></pre>
  153. <h2 id="ParseINI">func <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/oauth2.go?s=1135:1201#L33">ParseINI</a></h2>
  154. <pre>func ParseINI(ini <a href="../../../../io/index.html">io</a>.<a href="../../../../io/index.html#Reader">Reader</a>) (map[<a href="../../../../builtin/index.html#string">string</a>]map[<a href="../../../../builtin/index.html#string">string</a>]<a href="../../../../builtin/index.html#string">string</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  155. <h2 id="ParseKey">func <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/oauth2.go?s=636:686#L14">ParseKey</a></h2>
  156. <pre>func ParseKey(key []<a href="../../../../builtin/index.html#byte">byte</a>) (*<a href="../../../../crypto/rsa/index.html">rsa</a>.<a href="../../../../crypto/rsa/index.html#PrivateKey">PrivateKey</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  157. <p>
  158. ParseKey converts the binary contents of a private key file
  159. to an *rsa.PrivateKey. It detects whether the private key is in a
  160. PEM container or not. If so, it extracts the the private key
  161. from PEM container before conversion. It only supports PEM
  162. containers with no passphrase.
  163. </p>
  164. <h2 id="RegisterBrokenAuthHeaderProvider">func <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/token.go?s=3374:3428#L112">RegisterBrokenAuthHeaderProvider</a></h2>
  165. <pre>func RegisterBrokenAuthHeaderProvider(tokenURL <a href="../../../../builtin/index.html#string">string</a>)</pre>
  166. <h2 id="RegisterContextClientFunc">func <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/transport.go?s=1052:1104#L21">RegisterContextClientFunc</a></h2>
  167. <pre>func RegisterContextClientFunc(fn <a href="index.html#ContextClientFunc">ContextClientFunc</a>)</pre>
  168. <h2 id="ContextClientFunc">type <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/transport.go?s=940:1006#L17">ContextClientFunc</a></h2>
  169. <pre>type ContextClientFunc func(<a href="../../net/context/index.html">context</a>.<a href="../../net/context/index.html#Context">Context</a>) (*<a href="../../../../net/http/index.html">http</a>.<a href="../../../../net/http/index.html#Client">Client</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  170. <p>
  171. ContextClientFunc is a func which tries to return an *http.Client
  172. given a Context value. If it returns an error, the search stops
  173. with that error. If it returns (nil, nil), the search continues
  174. down the list of registered funcs.
  175. </p>
  176. <h2 id="ContextKey">type <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/transport.go?s=672:696#L11">ContextKey</a></h2>
  177. <pre>type ContextKey struct{}</pre>
  178. <p>
  179. ContextKey is just an empty struct. It exists so HTTPClient can be
  180. an immutable public variable with a unique type. It&#39;s immutable
  181. because nobody else can create a ContextKey, being unexported.
  182. </p>
  183. <pre>var <span id="HTTPClient">HTTPClient</span> <a href="index.html#ContextKey">ContextKey</a></pre>
  184. <p>
  185. HTTPClient is the context key to use with golang.org/x/net/context&#39;s
  186. WithValue function to associate an *http.Client value with a context.
  187. </p>
  188. <h2 id="ErrorTransport">type <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/transport.go?s=1921:1960#L55">ErrorTransport</a></h2>
  189. <pre>type ErrorTransport struct{ Err <a href="../../../../builtin/index.html#error">error</a> }</pre>
  190. <p>
  191. ErrorTransport returns the specified error on RoundTrip.
  192. This RoundTripper should be used in rare error cases where
  193. error handling can be postponed to response handling time.
  194. </p>
  195. <h3 id="ErrorTransport.RoundTrip">func (ErrorTransport) <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/transport.go?s=1962:2034#L57">RoundTrip</a></h3>
  196. <pre>func (t <a href="index.html#ErrorTransport">ErrorTransport</a>) RoundTrip(*<a href="../../../../net/http/index.html">http</a>.<a href="../../../../net/http/index.html#Request">Request</a>) (*<a href="../../../../net/http/index.html">http</a>.<a href="../../../../net/http/index.html#Response">Response</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  197. <h2 id="Token">type <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/token.go?s=717:1472#L20">Token</a></h2>
  198. <pre>type Token struct {
  199. <span class="comment">// AccessToken is the token that authorizes and authenticates</span>
  200. <span class="comment">// the requests.</span>
  201. AccessToken <a href="../../../../builtin/index.html#string">string</a>
  202. <span class="comment">// TokenType is the type of token.</span>
  203. <span class="comment">// The Type method returns either this or &#34;Bearer&#34;, the default.</span>
  204. TokenType <a href="../../../../builtin/index.html#string">string</a>
  205. <span class="comment">// RefreshToken is a token that&#39;s used by the application</span>
  206. <span class="comment">// (as opposed to the user) to refresh the access token</span>
  207. <span class="comment">// if it expires.</span>
  208. RefreshToken <a href="../../../../builtin/index.html#string">string</a>
  209. <span class="comment">// Expiry is the optional expiration time of the access token.</span>
  210. <span class="comment">//</span>
  211. <span class="comment">// If zero, TokenSource implementations will reuse the same</span>
  212. <span class="comment">// token forever and RefreshToken or equivalent</span>
  213. <span class="comment">// mechanisms for that TokenSource will not be used.</span>
  214. Expiry <a href="../../../../time/index.html">time</a>.<a href="../../../../time/index.html#Time">Time</a>
  215. <span class="comment">// Raw optionally contains extra metadata from the server</span>
  216. <span class="comment">// when updating a token.</span>
  217. Raw interface{}
  218. }</pre>
  219. <p>
  220. Token represents the crendentials used to authorize
  221. the requests to access protected resources on the OAuth 2.0
  222. provider&#39;s backend.
  223. </p>
  224. <p>
  225. This type is a mirror of oauth2.Token and exists to break
  226. an otherwise-circular dependency. Other internal packages
  227. should convert this Token into an oauth2.Token before use.
  228. </p>
  229. <h3 id="RetrieveToken">func <a href="http://localhost:6060/src/golang.org/x/oauth2/internal/token.go?s=4480:4590#L139">RetrieveToken</a></h3>
  230. <pre>func RetrieveToken(ctx <a href="../../net/context/index.html">context</a>.<a href="../../net/context/index.html#Context">Context</a>, clientID, clientSecret, tokenURL <a href="../../../../builtin/index.html#string">string</a>, v <a href="../../../../net/url/index.html">url</a>.<a href="../../../../net/url/index.html#Values">Values</a>) (*<a href="index.html#Token">Token</a>, <a href="../../../../builtin/index.html#error">error</a>)</pre>
  231. <div id="footer">
  232. Build version go1.6.<br>
  233. Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
  234. the content of this page is licensed under the
  235. Creative Commons Attribution 3.0 License,
  236. and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
  237. <a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
  238. <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
  239. </div>
  240. </div><!-- .container -->
  241. </div><!-- #page -->
  242. <!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
  243. <script type="text/javascript" src="../../../../../lib/godoc/jquery.js"></script>
  244. <script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.js"></script>
  245. <script type="text/javascript" src="../../../../../lib/godoc/jquery.treeview.edit.js"></script>
  246. <script type="text/javascript" src="../../../../../lib/godoc/godocs.js"></script>
  247. </body>
  248. </html>