Commit Graph

73 Commits

Author SHA1 Message Date
Paul Rosania 6f28996586 oauth2: Resource Owner Password Credentials grant
Adds support for the Resource Owner Password Credentials grant type, which
allows trusted clients to exchange user credentials for an access token
directly. This is generally a bad idea, but is extremely useful in some
situations, where an external redirect is undesirable or impossible.

See https://tools.ietf.org/html/rfc6749#section-4.3

Change-Id: I28efd77957bcf8e1174e93ba0c64a990b94eb839
Reviewed-on: https://go-review.googlesource.com/3862
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-02-06 10:06:27 +00:00
Aaron Jacobs 7b840c3264 oauth2: Remove what appears to be an out of date comment.
TokenRefresher with that capitalization is not a symbol, and SetToken
doesn't occur anywhere in the package as far as I can tell.

Change-Id: If61f059ed8bb1ca21e27aa99669e542160747fe7
Reviewed-on: https://go-review.googlesource.com/3958
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-05 23:49:51 +00:00
Aaron Jacobs 53c5ae1b31 oauth2: Fix some redundant wording in the docs for AccessTypeOnline.
Change-Id: I124553bd38b229e409e152cf364d55c847b70ba4
Reviewed-on: https://go-review.googlesource.com/3950
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-05 16:18:09 +00:00
Andrew Gerrand 27daa780a8 oauth2: add googleapis.com to list of broken oauth2 endpoints
Fixes #85

Change-Id: Ic60eee227763ab4041248716880416056c850f95
Reviewed-on: https://go-review.googlesource.com/3873
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-02-04 14:04:51 +00:00
Brad Fitzpatrick ed997606a9 oauth2, oauth2/jwt: break JWT off into its own package
Change-Id: Iaaa36728f87744e0d9609674f0d0ad96e6ac80b4
Reviewed-on: https://go-review.googlesource.com/2198
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-01-02 18:35:08 +00:00
Brad Fitzpatrick dfb470cc49 oauth2: fix typo in Token docs and clarify mutability of Token
Change-Id: I1093cffbd4b6fe25cd5b7cfb31e820b15fcfa41f
Reviewed-on: https://go-review.googlesource.com/2197
Reviewed-by: Burcu Dogan <jbd@google.com>
2014-12-31 03:26:08 +00:00
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
Brad Fitzpatrick f5b40b26f1 oauth2: use a JSON struct types instead of empty interface maps
Change-Id: Ifd66ea35c15dbd14acca0c945b533ec755de12e4
Reviewed-on: https://go-review.googlesource.com/1872
Reviewed-by: Burcu Dogan <jbd@google.com>
2014-12-20 06:52:21 +00:00
Brad Fitzpatrick 9abe144dd5 oauth2: move Token into its own file (no code changes)
Change-Id: I5248f48cc1af68a0f78a8ddf7e28b91a729f5460
Reviewed-on: https://go-review.googlesource.com/1870
Reviewed-by: David Symonds <dsymonds@golang.org>
2014-12-19 04:29:46 +00:00
Dave Day 7bbf2199a5 oauth2: add func NewClient as per issue #66
Change-Id: Icfae8530e725f2f31774e395319e6e6db330262a
Reviewed-on: https://go-review.googlesource.com/1701
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-17 00:04:06 +00:00
Johan Euphrosine a360c4ed80 oauth2: fix typo
Change-Id: Ic39a63c50a042ab836bbc496db9aea7fb52870d2
Reviewed-on: https://go-review.googlesource.com/1652
Reviewed-by: Burcu Dogan <jbd@google.com>
2014-12-16 18:11:04 +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
Brad Fitzpatrick a568078818 oauth2: redesign the API
Tests and examples aren't updated yet. The tree will be broken after this,
but nobody should be using this yet anyway.

Change-Id: I0004c738f40919ab46d107c71c011c510fbc748f
Reviewed-on: https://go-review.googlesource.com/1246
Reviewed-by: Burcu Dogan <jbd@google.com>
2014-12-16 06:20:49 +00:00
Andrew Gerrand 3ec35f1969 Merge branch 'master' of https://github.com/golang/oauth2 2014-11-28 10:17:23 +11: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 5fd31d511c Merge pull request #50 from snikch/fix-json-expiry
Handle expiry correctly in json response
2014-11-25 19:48:01 -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
Mal Curtis 778494f9ec Handle expiry correctly in json response
Go treats json numbers as float64 not int. Previously json response
expiry information was ignored since it was expected to be an int.
2014-11-21 13:07:44 +13:00
Burcu Dogan c048af9da2 Add Cacher interface. 2014-11-13 15:41:14 +11:00
Burcu Dogan 2d3ce25e9a Don't mutate the authorization endpoint.
Flow should be reusable, Options object should not be
mutated by the calls performed on the flow.
2014-11-12 10:02:14 +11:00
Burcu Dogan 0b8fcbadce Avoid setting an explicit token fetcher for the known flows. 2014-11-11 11:22:30 +11: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
Burcu Dogan 0ae3d4edc9 Allow users to get extra fields from a token response. 2014-10-27 20:01:11 -07:00
Burcu Dogan 4b407cace1 Support token expiration for Facebook OAuth 2.0.
Facebook's OAuth 2.0 implementation seems to be broken and
returns expires_in value in expires. Fallback to expires field to
handle the expiration time for Facebook.
2014-10-21 10:43:33 -07:00
Matt Jibson 123b41c5cb Add SoundCloud to the providers not supporting Auth headers 2014-10-04 02:16:01 -04:00
Matt Jibson 311200b953 Spelling 2014-10-04 02:15:35 -04:00
CL Sung 099e4f09b0 Add Linkedin to the providers not supporting Auth headers. 2014-09-11 10:49:49 +08:00
Burcu Dogan 85a0f4506d Merge pull request #37 from stacktic/DropboxAuthFix
Add Dropbox to the providers not supporting Auth headers.
2014-09-08 09:59:12 -07:00
Arnaud Ysmal e6396819be Add Dropbox to the providers not supporting Auth headers.
Dropbox does not support mixing URL param and Auth header for authentication but the retrieveToken method forces the client_id to be sent in the URL param.
2014-09-07 19:05:03 +02:00
JT Olds e68820a209 fix token exchange 2014-09-06 17:39:43 -06: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 cb029f4c1f Fix error message prefix. 2014-09-04 13:33:06 -07:00
Burcu Dogan bb8496880f Don't assume optional fields are required and use Basic Auth if available.
See https://github.com/golang/oauth2/issues/33
2014-09-04 13:28:18 -07:00
Burcu Dogan 32b8a902e6 client_secret should be optional. 2014-09-04 12:03:06 -07:00
Burcu Dogan cd4a6ded37 Removing non-required initial Client and Transport values. 2014-09-04 11:58:35 -07:00
Burcu Dogan 948919caa0 Merge branch 'httpclient' 2014-09-03 18:04:35 -07:00
Alif Rachmawadi eae9d0e836 removed NewTransport inline example 2014-09-03 08:27:29 +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
Alif Rachmawadi e049d530c3 fixed NewTransport example code 2014-09-02 21:17:45 +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 3a5e8819eb Rename exchange code to code, document as authorization code. 2014-08-16 21:21:58 -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 b314823c0b TokenFetcher should not mutate existing tokens. 2014-08-13 16:47:57 -07:00
Burcu Dogan b2a1756f98 Merge branch 'scopes-omit' 2014-08-13 14:05:44 -07:00
Burcu Dogan de4c4313f9 Adding required client_secret credential. 2014-08-13 13:59:53 -07:00
Burcu Dogan f9dc7568c2 Docs improvements, lint error fixes. 2014-08-13 13:40:18 -07:00
Burcu Dogan 03e5fbeae0 Fixing json tags. 2014-08-12 23:42:30 -07:00
Burcu Dogan a9dc52b3d3 Docs, code cleanups. 2014-08-12 19:50:34 -07:00
Burcu Dogan 4c579cbd0d Export exchange.
Allows users to exchange and retrieve a token
without initialising a Transport.
2014-08-11 00:27:43 -07:00