Asim Shankar | 6107179 | 2014-07-22 13:03:18 -0700 | [diff] [blame] | 1 | // Package identity defines services for identity providers in the veyron ecosystem. |
| 2 | package identity |
| 3 | |
| 4 | |
Asim Shankar | 7a72175 | 2014-08-02 14:27:23 -0700 | [diff] [blame] | 5 | // OAuthBlesser exchanges OAuth authorization codes OR access tokens for |
| 6 | // an email address from an OAuth-based identity provider and uses the email |
| 7 | // address obtained to bless the client. |
Asim Shankar | 6107179 | 2014-07-22 13:03:18 -0700 | [diff] [blame] | 8 | // |
Asim Shankar | 7a72175 | 2014-08-02 14:27:23 -0700 | [diff] [blame] | 9 | // OAuth is described in RFC 6749 (http://tools.ietf.org/html/rfc6749), |
| 10 | // though the Google implementation also has informative documentation at |
| 11 | // https://developers.google.com/accounts/docs/OAuth2 |
| 12 | // |
| 13 | // WARNING: There is no binding between the channel over which the |
| 14 | // authorization code or access token was obtained (typically https) |
| 15 | // and the channel used to make the RPC (a veyron virtual circuit). |
| 16 | // Thus, if Mallory possesses the authorization code or access token |
| 17 | // associated with Alice's account, she may be able to obtain a blessing |
| 18 | // with Alice's name on it. |
| 19 | // |
| 20 | // TODO(ashankar,toddw): Once the "OneOf" type becomes available in VDL, |
| 21 | // then the "any" should be replaced by: |
| 22 | // OneOf<wire.ChainPublicID, []wire.ChainPublicID> |
| 23 | // where wire is from: |
Jiri Simsa | 519c507 | 2014-09-17 21:37:57 -0700 | [diff] [blame^] | 24 | // import "veyron.io/veyron/veyron2/security/wire" |
Asim Shankar | 6107179 | 2014-07-22 13:03:18 -0700 | [diff] [blame] | 25 | type OAuthBlesser interface { |
Asim Shankar | 7a72175 | 2014-08-02 14:27:23 -0700 | [diff] [blame] | 26 | // BlessUsingAuthorizationCode exchanges the provided authorization code |
| 27 | // for an access token and then uses that access token to obtain an |
| 28 | // email address. |
| 29 | // |
| 30 | // The redirect URL used to obtain the authorization code must also |
| 31 | // be provided. |
| 32 | BlessUsingAuthorizationCode(authcode, redirecturl string) (blessing any, err error) |
| 33 | |
| 34 | // BlessUsingAccessToken uses the provided access token to obtain the email |
| 35 | // address and returns a blessing. |
| 36 | BlessUsingAccessToken(token string) (blessing any, err error) |
Jiri Simsa | 519c507 | 2014-09-17 21:37:57 -0700 | [diff] [blame^] | 37 | } |