Commit Graph

157 Commits

Author SHA1 Message Date
Brad Fitzpatrick a379e41d44 oauth2, oauth2/google: add, use ReuseTokenSource
Token caching is now done whenever you make a Client, and
ReuseTokenSource is exported from the oauth2 package and used by the
Google TokenSources (Compute and App Engine).

Token.Expired is now Token.Valid, and works on nil receivers.

Some other wording cleanups in the process.

All tests pass. App Engine should pass, but is untested.

Change-Id: Ibe1d2599ac3ccfe9b399b1672f74bb24cfc8d311
Reviewed-on: https://go-review.googlesource.com/2195
Reviewed-by: Burcu Dogan <jbd@google.com>
2014-12-30 22:27:30 +00:00
Burcu Dogan 13407478f7 oauth2/google: better instructions for the PKCS12 to PEM conversion
Change-Id: Ibcbde1e0131e0a1f90f66978d9b9a7f3aa3dceb6
Reviewed-on: https://go-review.googlesource.com/1660
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-17 00:34:13 +00:00
Burcu Dogan 9b6b7610ad oauth2: rewrite google package, fix the broken build
Change-Id: I2753a88d7be483bdbc0cac09a1beccc4806ea4bc
Reviewed-on: https://go-review.googlesource.com/1361
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-16 06:20:58 +00:00
Burcu Dogan e750a2fd5a oauth2: add vanity URL import comments, use the vanity URL on builds
Change-Id: Ia20e40d98aa709e3d598388e0a15501584152ab5
2014-11-26 11:47:34 -08:00
Burcu Dogan b846388564 oauth2: Removing the inconsistent and duplicate features, better naming
- Removed Flow, flow is a nothing but options.
- Renamed Cacher to Storer.
- Removed the setter from the Transport. Store should do the initial set.
  Getter is not removed, because extra fields are available through
  Transport.Token.Extra(). It's not pleasant to implement a custom Storer
  implementation to read such values.

oauth2: Remove VMs from the AppEngine example title
2014-11-25 14:36:49 -08:00
Burcu Dogan 0cf6f9b144 Introduce an option function type
- Reduce the duplicate code by merging the flows and
determining the flow type by looking at the provided options.
- Options as a function type allows us to validate an individual
an option in its scope and makes it easier to compose the
built-in options with the third-party ones.
2014-11-08 09:46:26 +11:00
Glenn Lewis 94c2b61903 Locally cache oauth tokens.
This change is for both App Engine and Managed VMs so that these apps can scale without running into the app_identity_service quota limit due to calling appengine.AccessToken too frequently.  An added benefit of caching is that calls to Google APIs will be significantly sped up due to removing the round-trip calls to the api_identity_service.
2014-10-31 16:04:03 -07:00
Burcu Dogan 2e27b6b6cb Handle non-2xx for metadata server responses. 2014-10-23 10:06:00 -07:00
Paddy Foran ad051cf1e6 Update metadata server URL to be a FQDN.
Without a fully qualified domain name, containers (like Docker) can't
connect to the metadata server. Update the address for the metadata
server to be a FQDN so containers can use the library. See #44.
2014-10-07 17:38:45 -04:00
Andrew Gerrand c03fd6cc9b Merge branch 'master' of github.com:golang/oauth2 2014-09-30 07:38:32 +10:00
Andrew Gerrand 040e271ca2 use variadics and fix build tags for App Engine files 2014-09-30 07:38:10 +10:00
Burcu Dogan 7ffb9a8fe1 Fixing path.join for URL generation. 2014-09-22 08:37:20 -07:00
Burcu Dogan a388976807 Fixing build constraints for GAE and GAE managed runtime.
GAE managed VM runtime contains both appengine and appenginevm
build tags. Currently, appengine.go is being built even if user
wants to use the package on managed VM that errors with no
"appengine" package to import.
2014-09-08 13:34:36 -07:00
Burcu Dogan 97a89b3be5 Access type and approval prompt should be set at URL generation. 2014-09-04 23:30:06 -07:00
Burcu Dogan 9d409b9dbd Merge branch 'jsonkeyfile' 2014-09-03 19:26:04 -07:00
Burcu Dogan 948919caa0 Merge branch 'httpclient' 2014-09-03 18:04:35 -07:00
Burcu Dogan 331436720f Adding support for Google Developers Console JSON key files. 2014-09-03 18:02:55 -07:00
Burcu Dogan 9d55d5b30b Relax AppEngineConfig to allow RoundTrippers. 2014-09-03 17:20:29 -07:00
Burcu Dogan 533cae1f5a Add missing license headers. 2014-09-03 11:50:43 -07:00
Burcu Dogan 8524783bd7 Allow configs to be initialised with zero values for Client and Transport. 2014-09-02 14:06:51 -07:00
Burcu Dogan 32b45383ad Managed VM users should depend on http.DefaultTransport by default. 2014-08-31 16:08:13 -07:00
Burcu Dogan 6bb0a5207a Do not assume that http.DefaultClient and http.DefaultTransport is always available. 2014-08-31 15:17:36 -07:00
Burcu Dogan 03a41b25d4 Don't assume private key to be available on a traditional file system. 2014-08-18 12:49:20 -07:00
Burcu Dogan ee77246177 Don't provide a Transport interface but provide a http.RoundTripper implementation. 2014-08-14 10:59:09 -07:00
Burcu Dogan f9dc7568c2 Docs improvements, lint error fixes. 2014-08-13 13:40:18 -07:00
Burcu Dogan 6d8f8ea9d2 Avoid concatenating scope literals. 2014-08-05 12:25:29 -07:00
Burcu Dogan 70bd497612 Fail during conf init if auth or token URL is not valid. 2014-07-20 16:56:38 -07:00
Burcu Dogan 7935ece62b Export Transport to allow default transport to be configurable. 2014-07-14 10:59:30 -07:00
Burcu Dogan 6b4f2ed2ce Use default client rather than a new client instance. 2014-07-14 10:26:21 -07:00
Burcu Dogan 648dd50ab3 Revert "App Engine Managed VMs should depend on url fetcher."
This reverts commit 4901e89da7.
2014-07-14 10:21:39 -07:00
Burcu Dogan 4901e89da7 App Engine Managed VMs should depend on url fetcher. 2014-07-14 10:04:48 -07:00
Burcu Dogan 0f597d5ad4 oauth2: don't use http.DefaultTransport.
http.DefaultTransport is not available on App Engine.
2014-07-11 10:57:28 -07:00
Johan Euphrosine 93ad3f4a9e remove cache 2014-07-08 22:27:34 -07:00
Burcu Dogan 0221bdd0c9 Adding TODO to remove dummy tests after go1.4. 2014-06-24 14:53:39 -07:00
Burcu Dogan cb989650ab Fix examples. 2014-06-24 14:28:46 -07:00
Burcu Dogan 49766fd328 Add app engine and compute engine examples. 2014-06-24 13:27:04 -07:00
Burcu Dogan fe0eecc41c Some cleanup, adding Google web flow example. 2014-06-24 13:10:10 -07:00
Burcu Dogan 6ee9c84a7b App Engine implementations should use the cached transport. 2014-06-22 14:46:15 -07:00
Burcu Dogan ea046b80de Merge branch 'master' into cache 2014-06-22 14:42:28 -07:00
Burcu Dogan 7a2df5bea3 Add docs. 2014-06-22 14:39:35 -07:00
Burcu Dogan a443e46636 Make app engine main implementation godoced. 2014-06-20 14:44:24 -07:00
Burcu Dogan 4337573be3 oauth2: perform caching ops at the transport level 2014-06-17 16:09:09 +02:00
Burcu Dogan bf10685289 Adding app engine implementations. 2014-06-17 15:53:08 +02:00
Burcu Dogan 5c1195ac3f Constructor can't return an error for Compute Engine confs. 2014-05-30 13:02:54 +02:00
Burcu Dogan 075fdd8e10 Fix oauth2's import path. 2014-05-30 12:39:43 +02:00
Burcu Dogan 904252a9e8 ComputeEngineConfig should implement TokenFetcher. 2014-05-27 14:37:57 +02:00
Burcu Dogan 13179d7d8a Switch to google.golang.org based import path. 2014-05-27 14:37:35 +02:00
Burcu Dogan abc4bcd940 Reverting the license back to the original. 2014-05-17 17:26:57 +02:00
Burcu Dogan 643fd905db Avoid returning non-existent errors. 2014-05-15 12:09:36 +02:00
Burcu Dogan 6c54258546 Package will be available on github.com/golang/oauth2. 2014-05-15 11:53:56 +02:00
Burcu Dogan c0f71b6bc4 Fixing import path. 2014-05-14 12:05:11 +03:00
Burcu Dogan d7c8bcd0d0 oauth2: adding license. 2014-05-13 21:06:46 +03:00
Burcu Dogan 223212dc91 Adding token fetching implementing for Compute Engine. 2014-05-11 18:06:03 +03:00
Burcu Dogan c1d53e71ad Minor docs fix. 2014-05-10 14:50:51 +03:00
Burcu Dogan 1b3c225070 oauth2: removing unnecessary interface definitions. 2014-05-10 14:43:21 +03:00
Burcu Dogan 2af52e700e oauth2: fixing abstractions to be able to provide external token fetchers 2014-05-10 09:41:39 +02:00
Burcu Dogan c32debaa6f Initial commit 2014-05-09 23:05:13 +02:00