Commit Graph

245 Commits

Author SHA1 Message Date
Brad Fitzpatrick 4470bd844e google: fix the build when appengine isn't present
See https://build.golang.org/log/c3e046245c4eafbb7b2571ef9ac144b0d29ba2b5

Updates golang/go#11811

Change-Id: I16d2ac26dcda123e1bd8c456e490f6ca45111d24
Reviewed-on: https://go-review.googlesource.com/24946
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-07-15 18:42:06 +00:00
Jaana Burcu Dogan 7357e96168 internal: decapitalize the argument names
Change-Id: I108ea0e49c5a96afb616918b9367085c159fb157
Reviewed-on: https://go-review.googlesource.com/24770
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-07-06 23:19:41 +00:00
Dave Day df5b72659a google: support key ID in JWTAccessTokenSourceFromJSON
Change-Id: I20ffede5bf81aa4990afb2820561d5633cdb43a8
Reviewed-on: https://go-review.googlesource.com/24440
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-02 01:08:09 +00:00
Andrew Gerrand 65a8d08c62 Revert "passwordcredentials: add"
This reverts commit 71d9edd725.

It was already implemented by https://godoc.org/golang.org/x/oauth2#Config.PasswordCredentialsToken

Change-Id: I9a8ccb00256ef291a11c9a9923a4390ab0159b42
Reviewed-on: https://go-review.googlesource.com/23841
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
2016-06-08 21:51:09 +00:00
Joseph Anthony Pasquale Holsten 71d9edd725 passwordcredentials: add
Using PasswordCredentialsToken requires a TokenSource. This implements a
Config similar to oauth2/clientcredentials for the Resource Owner Password
Credentials Grant.

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

Fixes https://github.com/golang/oauth2/issues/186

Change-Id: I3c6032899d6c286b84f8f24e0f6a240004f4f6c0
Reviewed-on: https://go-review.googlesource.com/23611
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-07 01:33:01 +00:00
Jaana Burcu Dogan c406a4cc4b travis: always build against tip
x packages are not guranteed to build against previous versions of
Go. The current build is failing because of:

../net/context/ctxhttp/ctxhttp.go:35: req.Cancel undefined

Change-Id: Ib7ee48455c1c2d04aa6b82e2202a3796fcf3478d
Reviewed-on: https://go-review.googlesource.com/23286
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-20 18:58:28 +00:00
Jeff Craig e86e2718db internal: fix transport_test use of nil Context
The context library recommends never using a nil Context, and
context.Background() provides an empty Context appropriate for use in
unit tests.

Change-Id: I2656f846ea1f892ad41ad63a92ecb789a46e3453
Reviewed-on: https://go-review.googlesource.com/22791
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-04 21:42:46 +00:00
Jeff Craig 8434495902 jws: Fix typo in jws_test
Test is currently failing due to a missed colon during cleanup.

Change-Id: I8cef4b679b2d981ad159441bffac67b7b23862aa
Reviewed-on: https://go-review.googlesource.com/22742
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-03 22:27:16 +00:00
Jeff Craig 14446d3f8b jws: add RS256 Verification for JWS
Provides helper method for verifying a signed JWT against a provided
public key.

Change-Id: I498ecfce07862c372fd5f81c1fcdc09692ed0f5c
Reviewed-on: https://go-review.googlesource.com/21762
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-03 22:07:24 +00:00
Sean Harger f6a14f0423 google: Update godocs to reflect recent GCP front-end changes.
Updated references to the API manager to reflect the new stand-alone API
manager at http://console.developers.google.com.

Change-Id: I156cce7b844850a560bfbf2b64fb0d8da5edaefe
Reviewed-on: https://go-review.googlesource.com/22706
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-03 00:48:36 +00:00
Sam Whited 9ef2eddcc6 hipchat: Generate Config for Connect integrations
Adds a function to generate a clientcredentials.Config from a HipChat
Connect addon's capability descriptor and a provided application secret.
Useful when writing addons.

Change-Id: I4578f5683aa9ed728e503cb3b08ff0bf743a62a4
Reviewed-on: https://go-review.googlesource.com/22397
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-28 20:45:44 +00:00
Cheng-Lung Sung 7e9cd5d595 oauth2: remove mockCache since NewTransportFromTokenStore() removed.
Since NewTransportFromTokenStore() is removed, mockCache is therefore
useless. It should be safe to remove it, too.

Change-Id: I5678684af31e5de75e420b28d859e33909e0a718
Reviewed-on: https://go-review.googlesource.com/22113
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
2016-04-15 16:57:16 +00:00
Sam Whited b0e2337fe6 hipchat: Add endpoint function for HipChat server
Change-Id: I4578f5683aa9ed728e503cb3b08ff0bf743a62a2
Reviewed-on: https://go-review.googlesource.com/21712
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 13:56:14 +00:00
Diwaker Gupta 33fa30fe45 oauth2/internal: Add api.dropboxapi.com to broken providers.
This is actually the recommended endpoint per the API docs:
https://www.dropbox.com/developers/documentation/http/documentation

Change-Id: I320189c94f727d10a75c4fde4768cef30c28030f
Reviewed-on: https://go-review.googlesource.com/21143
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-25 22:15:09 +00:00
Sam Whited 2897dcade1 hipchat: Add HipChat API endpoints
The endpoints are documented here:
https://developer.atlassian.com/hipchat/guide/hipchat-rest-api/api-access-tokens

Change-Id: I4578f5683aa9ed728e503cb3b08ff0bf743a62a1
Reviewed-on: https://go-review.googlesource.com/21051
Reviewed-by: Burcu Dogan <jbd@google.com>
2016-03-23 19:21:19 +00:00
Matt Layher 93758b5cba fitbit: add Fitbit API endpoints
Change-Id: I4578f5683aa9ed728e503cb3b08ff0bf743a6190
Reviewed-on: https://go-review.googlesource.com/21034
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-23 03:46:10 +00:00
Colin Edwards 045497edb6 internal: add Patreon to the broken auth list
Change-Id: I764ff2923f3c8a87f91893b47827068f093c4437
Reviewed-on: https://go-review.googlesource.com/20232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-04 21:31:35 +00:00
Andrew Gerrand 2cd4472c32 internal: add Wunderlist to list of broken auth providers
Fixes golang/go#14439

Change-Id: I6b72562d5d49d4c847390438dee11ce41bf46918
Reviewed-on: https://go-review.googlesource.com/19784
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-22 10:17:51 +00:00
Xudong Zhang 1f9b3a17f0 internal: add baidu.com to the broken auth list
Change-Id: I17fe6f8fce63c7d68975450ba106698533c392d9
Reviewed-on: https://go-review.googlesource.com/19742
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-20 17:16:45 +00:00
Tim Swast 188fb45fbe slack: new package with Slack's endpoints
Change-Id: Ie461323194d73cdb9600e03abb96356637afc15d
Reviewed-on: https://go-review.googlesource.com/19525
Reviewed-by: Burcu Dogan <jbd@google.com>
2016-02-17 21:10:11 +00:00
Emmanuel Odeke 8a57ed94ff transport_test: added TestNilTokenSource + close res.Body per GET
+ TestTransportNilTokenSource added.
+ res.Body.Close() in tests to cut leaks
and also to increase test coverage for *onEOFReader.

Change-Id: I1b962b7ecbc4f6f8b5bcccc6870c025e89ad9c1a
Reviewed-on: https://go-review.googlesource.com/18141
Reviewed-by: Burcu Dogan <jbd@google.com>
2016-01-21 06:19:03 +00:00
Vadim Grek 191c6170f6 microsoft: add windows live endpoints
Change-Id: I205dfb6c4d693929da799dcba40b3539c6302100
Reviewed-on: https://go-review.googlesource.com/18691
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-19 17:57:29 +00:00
Burcu Dogan 2baa8a1b93 internal: primarily use the HTTP client provided in the context
Change-Id: I99eaf1480ebdfbaa5b64ac17203fbf14bf887962
Reviewed-on: https://go-review.googlesource.com/17396
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-12-04 19:36:38 +00:00
Burcu Dogan 442624c9ec oauth2: allow users to register broken OAuth2 implementations
Fixes golang/oauth2#111.

Change-Id: Iaea8adb038bcff91b4b468b1a3bdaa5c03d7e8e7
Reviewed-on: https://go-review.googlesource.com/16976
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-11-17 21:03:13 +00:00
Andrew Gerrand 2bf5e6e27a internal: add Salesforce to list of broken auth providers
Fix #163

Change-Id: Id2c5f34b9d5b6854d59dd8122fb3460d83352b5c
Reviewed-on: https://go-review.googlesource.com/16856
Reviewed-by: Christian Ohler <ohler@driveshift.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-11-16 23:58:02 +00:00
Andrew Gerrand 3314c49c83 internal: add microsoftonline.com to list of broken providers
Fixes #161

Change-Id: Iec1b95b766bf88c7c015cf3ff7496339d8b3e20f
Reviewed-on: https://go-review.googlesource.com/16753
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-11-09 22:44:55 +00:00
David Symonds d4780cd8b5 jws: fix base64Decode for strings of length 1 (mod 4).
Change-Id: I5369e4d5454de2cf041363af1328f69d526b17d4
Reviewed-on: https://go-review.googlesource.com/16750
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-09 05:46:33 +00:00
David Symonds e347d2238c jws: add EncodeWithSigner function.
This permits controlling the mechanism for signing the token;
for instance, one can use EncodeWithSigner in an App Engine app
to use the App Identity API to perform the signing (you don't have
direct access to the private key there).

An alternate would be to replace Encode with EncodeWithSigner,
and add a little wrapper type that turns a *rsa.PrivateKey into
a Signer. That's probably what I'd do if this were being written
from scratch, but I wasn't keen on breaking existing code.

Change-Id: Id48f5dfa15c179832e613268d4a4098b96648f9a
Reviewed-on: https://go-review.googlesource.com/16711
Reviewed-by: Burcu Dogan <jbd@google.com>
Run-TryBot: David Symonds <dsymonds@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-09 00:47:20 +00:00
Andrew Gerrand 038cb4adce all: change copyright to 'Go Authors'
Fixes golang/go#12354

Change-Id: Ie4bbe9445e2a840c9db830c9bd52a783b7a6f9bc
Reviewed-on: https://go-review.googlesource.com/13952
Reviewed-by: Russ Cox <rsc@golang.org>
2015-10-22 04:14:42 +00:00
John ShaggyTwoDope Jenkins ef4eca6b09 small typo fix in clientcredentials.go
Change-Id: If564daf4d164c27b2748b9c4c4ff274f3601184c
Reviewed-on: https://go-review.googlesource.com/15805
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-13 21:51:12 +00:00
Emmanuel Odeke 2fbf3d7329 token: extra numeric values + test TokenType case
+ Added tests for TokenType by checking case.
+ Added numeric conversion for float and integer like
  values from token.Extra.

Change-Id: I0909a4458ed58e33428afbf40478a668d150dda7
Reviewed-on: https://go-review.googlesource.com/15156
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-01 05:36:47 +00:00
Burcu Dogan 3cab960fb9 internal: add slack.com to the broken auth list
Change-Id: I491418962516c71ee61eba2a4bac76967c75a5da
Reviewed-on: https://go-review.googlesource.com/15049
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-28 18:31:21 +00:00
Andrew Gerrand c30abeebd1 internal: remove GitHub from the list of broken providers
See #155 for context

Change-Id: I91bd4186465e7489fd9d28f9f9dc2243218ba6ff
Reviewed-on: https://go-review.googlesource.com/14936
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-24 05:58:55 +00:00
Andrew Gerrand 166f7cf994 google: set expiry on JWTAccessTokenSource
Change-Id: Ib1ff6511ce38e17711486743601241285a34f164
Reviewed-on: https://go-review.googlesource.com/14934
Reviewed-by: Julien Boeuf <jboeuf@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-24 05:27:11 +00:00
Emmanuel Odeke 82de3fe653 jwt: added missing format specifier
Updates golang/oauth#151

Change-Id: I2422dade4d72aa4fc33d9ad922508d2793e4ee27
Reviewed-on: https://go-review.googlesource.com/14779
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-09-22 02:43:36 +00:00
robnorman d5ff5ab876 jwt: allow setting a custom expiry time for JWT tokens
The current implementation of JWS/JWT in this package uses a fixed
1 hour expiry time for JWT tokens.

Some services do not accept such a long expiry time, e.g. Salesforce,
which defaults to a 5 minute expiry.
https://help.salesforce.com/HTViewHelpDoc?id=remoteaccess_oauth_jwt_flow.htm

This change adds an Expires time.Duration property to the jwt.Config
struct that, if set, will be used to calculate the jws.ClaimSet Exp property.
It allows a custom expiry to be set on a JWT token.

This change is backward compatible and will revert to previous behaviour if
the Expires property is not set.

Fixes golang/oauth2#151

Change-Id: I3159ac2a5711ef10389d83c0e290bfc7a9f54015
Reviewed-on: https://go-review.googlesource.com/14681
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-09-21 17:56:07 +00:00
Manu S Ajith 9ecad5029b bitbucket: add end points
Change-Id: I0dee5ae8d822ecf0bc873534fbbba5d0ec546c7b
Reviewed-on: https://go-review.googlesource.com/14664
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-17 03:41:47 +00:00
Chris Broadfoot 52dcf34690 google: Re-enable AppEngineTokenSource to be used from Managed VMs.
Fixes #152.

Change-Id: I757c011d3ac5dca8f80fb2119eda3adf8c178ca6
Reviewed-on: https://go-review.googlesource.com/14622
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-16 01:14:15 +00:00
Chris Broadfoot ad0128250e Remove use of appenginevm build tag.
Managed VM apps can use the net/http package directly, and can use the
metadata server instead of the appengine package to get Service Account
tokens.

Change-Id: Ifa30eea446ffe4a9121ce3401900f4b73ddf07db
Reviewed-on: https://go-review.googlesource.com/14125
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-02 21:49:11 +00:00
Andrew Gerrand 897d9734bb google: set token type on returned JWTAccessToken, tweak docs
Change-Id: Id83af8110c7c89ca5ffe793149230fa3f87a6baf
Reviewed-on: https://go-review.googlesource.com/14198
Reviewed-by: Dave Day <djd@golang.org>
2015-09-02 03:46:34 +00:00
Andrew Gerrand 397fe76494 google: add support for JWT Access Tokens
This is a new form of authentication for Google services, where instead
of passing a signed claim to obtain a token from the OAuth endpoint, you
present the signed claim *as* the token to the API endpoint.

Fixes #139.
Fixes #140.

Change-Id: Ibf0f168a0ec111660ac08b86121c943fb96e146c
Reviewed-on: https://go-review.googlesource.com/10667
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Dave Day <djd@golang.org>
2015-08-13 22:40:26 +00:00
Lucien Stuker 8914e5017c oauth2: add api.netatmo.net to the broken providers
The auth on Netatmo api need ClientSecret in post request.

Like descripted in github issue at
https://github.com/golang/oauth2/issues/111

Change-Id: Ia85120d231e8a5c0ec851ddc3557bad26ecad41d
Reviewed-on: https://go-review.googlesource.com/11833
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-01 21:58:07 +00:00
Andrew Gerrand b5adcc2dcd doc: fix typo
Change-Id: I16b7afa3d3ffe8cda083e2189ec6e18e3c6038c0
Reviewed-on: https://go-review.googlesource.com/10444
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-27 20:54:32 +00:00
Andrew Etter 36ff901f7b oauth2: ensure case sensitivity for Bearer, MAC, and Basic in auth header
Fixes #113

Change-Id: Id2ba98809a536f1dc1fab5b30c49aeedd2fe4125
Reviewed-on: https://go-review.googlesource.com/9852
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-05-26 02:24:55 +00:00
Burcu Dogan f98d016087 oauth2: use the correct import path for urlfetch
Change-Id: Ie8654298c317f3465c225fad25660cdc5e2907cd
Reviewed-on: https://go-review.googlesource.com/9932
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-11 22:20:45 +00:00
Will Norris e296c42d12 oauth2: add StaticTokenSource to return static tokens
Fixes #120

Change-Id: I2ef0cbf87c7124b89a68b5db0080f916c630072d
Reviewed-on: https://go-review.googlesource.com/9895
Reviewed-by: Burcu Dogan <jbd@google.com>
2015-05-11 20:37:49 +00:00
Daniel Kerwin 2159a45684 oauth2: add user.gini.net to the broken providers
Change-Id: I4fa586bec82309bad4dbb02ae6b722f9c19608f6
Reviewed-on: https://go-review.googlesource.com/9804
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-08 14:32:49 +00:00
Burcu Dogan ec6d5d770f oauth2: add test-sandbox.auth.corp.google.com to the broken providers
Change-Id: I1d2e1ea803283b5651a482445b9be60262b43c4e
Reviewed-on: https://go-review.googlesource.com/9343
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-27 20:39:21 +00:00
ttacon 23f31c341b oauth2: Add Box to the list of broken OAuth providers.
Change-Id: I85f44714ec0571dc0358aecdc1cde92dca954da0
Reviewed-on: https://go-review.googlesource.com/8830
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-21 00:15:29 +00:00
Aaron Torres a8c019d04a oauth2: add support for client credential grant type
Creates a new package called clientcredentials and
adds transport and token information to the internal
package. Also modifies the oauth2 package to make
use of the newly added files in the internal package.

The clientcredentials package allows for token requests
using a "client credentials" grant type.

Fixes https://github.com/golang/oauth2/issues/7

Change-Id: Iec649d1029870c27a2d1023baa9d52db42ff45e8
Reviewed-on: https://go-review.googlesource.com/2983
Reviewed-by: Burcu Dogan <jbd@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-18 00:13:27 +00:00