hwi/HWIOAuthBundle — pull request #189 by regularjack (2013-01-28 15:15:39+00:00)
Title: Add support for OAuth2 refresh tokens

According to the [OAuth2 standard](http://tools.ietf.org/html/draft-ietf-oauth-v2-10#section-4.2), the Access Token response contains the following fields:

* access_token [REQUIRED]. The access token issued by the authorization server.
* expires_in [OPTIONAL]. The duration in seconds of the access token lifetime.
* refresh_token [OPTIONAL]. The refresh token used to obtain new access tokens. **Note that this field is only returned the first time the user grants access.**

This PR adds the `refresh_token` and `expires_in` fields to the `OAuthToken` class and defines a new method on the `GenericOAuth2ResourceOwner` called `refreshAccessToken` that takes the `refresh_token` as parameter and returns a new `access_token` along with it's `expires_in` value.

Additionally, a new `access_type` configuration option is defined. This option is passed to the `getAuthorizationUrl` call by the `GoogleResourceOwner` to demand for offline access. For more information see [Google's OAuth2 documentation](https://developers.google.com/accounts/docs/OAuth2WebServer#offline).

Note that since `access_type` is not standard OAuth2, it's not set by the `GenericOAuth2ResourceOwner` but by `GoogleResourceOwner`. In the future, other resource owners may pass this option too if need be. Setting `access_type=offline` for a `google` resource will return a `refresh_token` along
with the `access_token`.