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>
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>
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>
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>
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>
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>
+ 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>
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>
+ 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>
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.
Fixesgolang/oauth2#151
Change-Id: I3159ac2a5711ef10389d83c0e290bfc7a9f54015
Reviewed-on: https://go-review.googlesource.com/14681
Reviewed-by: Burcu Dogan <jbd@google.com>
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>
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>
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>
SetParam is quite vague to represent an Option that sets the auth
URL query parameters. Renaming it for explicitness.
Fixes#108.
Change-Id: Ic9f0181097820ee83404c9432451d71658dd8c67
Reviewed-on: https://go-review.googlesource.com/8491
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
json.UnmarshalError has a new field in Go 1.5. Adjust tests to cope.
Change-Id: I6733b2e14513794676e7329a828001f3f8c6c342
Reviewed-on: https://go-review.googlesource.com/8341
Reviewed-by: Burcu Dogan <jbd@google.com>