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 | |
Asim Shankar | b3a82ba | 2014-10-29 11:41:27 -0700 | [diff] [blame] | 4 | import "veyron.io/veyron/veyron2/security" |
| 5 | |
Suharsh Sivakumar | d308c7e | 2014-10-03 12:46:50 -0700 | [diff] [blame] | 6 | // OAuthBlesser exchanges OAuth access tokens for |
Asim Shankar | 7a72175 | 2014-08-02 14:27:23 -0700 | [diff] [blame] | 7 | // an email address from an OAuth-based identity provider and uses the email |
| 8 | // address obtained to bless the client. |
Asim Shankar | 6107179 | 2014-07-22 13:03:18 -0700 | [diff] [blame] | 9 | // |
Asim Shankar | 7a72175 | 2014-08-02 14:27:23 -0700 | [diff] [blame] | 10 | // OAuth is described in RFC 6749 (http://tools.ietf.org/html/rfc6749), |
| 11 | // though the Google implementation also has informative documentation at |
| 12 | // https://developers.google.com/accounts/docs/OAuth2 |
| 13 | // |
Suharsh Sivakumar | d308c7e | 2014-10-03 12:46:50 -0700 | [diff] [blame] | 14 | // WARNING: There is no binding between the channel over which the access token |
| 15 | // was obtained (typically https) and the channel used to make the RPC (a |
| 16 | // veyron virtual circuit). |
| 17 | // Thus, if Mallory possesses the access token associated with Alice's account, |
| 18 | // she may be able to obtain a blessing with Alice's name on it. |
Asim Shankar | 6107179 | 2014-07-22 13:03:18 -0700 | [diff] [blame] | 19 | type OAuthBlesser interface { |
Asim Shankar | 7a72175 | 2014-08-02 14:27:23 -0700 | [diff] [blame] | 20 | // BlessUsingAccessToken uses the provided access token to obtain the email |
Ankur | 3c33d42 | 2014-10-09 11:53:25 -0700 | [diff] [blame] | 21 | // address and returns a blessing along with the email address. |
Asim Shankar | b3a82ba | 2014-10-29 11:41:27 -0700 | [diff] [blame] | 22 | BlessUsingAccessToken(token string) (blessing security.WireBlessings, email string, err error) |
Jiri Simsa | 519c507 | 2014-09-17 21:37:57 -0700 | [diff] [blame] | 23 | } |
Suharsh Sivakumar | d308c7e | 2014-10-03 12:46:50 -0700 | [diff] [blame] | 24 | |
| 25 | // MacaroonBlesser returns a blessing given the provided macaroon string. |
| 26 | type MacaroonBlesser interface { |
| 27 | // Bless uses the provided macaroon (which contains email and caveats) |
| 28 | // to return a blessing for the client. |
Asim Shankar | b3a82ba | 2014-10-29 11:41:27 -0700 | [diff] [blame] | 29 | Bless(macaroon string) (blessing security.WireBlessings, err error) |
Suharsh Sivakumar | d308c7e | 2014-10-03 12:46:50 -0700 | [diff] [blame] | 30 | } |