blob: ada48b24bbd84040e2e93eee93729611fe945ab3 [file] [log] [blame]
Asim Shankar61071792014-07-22 13:03:18 -07001// Package identity defines services for identity providers in the veyron ecosystem.
2package identity
3
Asim Shankarb3a82ba2014-10-29 11:41:27 -07004import "veyron.io/veyron/veyron2/security"
5
Suharsh Sivakumard308c7e2014-10-03 12:46:50 -07006// OAuthBlesser exchanges OAuth access tokens for
Asim Shankar7a721752014-08-02 14:27:23 -07007// an email address from an OAuth-based identity provider and uses the email
8// address obtained to bless the client.
Asim Shankar61071792014-07-22 13:03:18 -07009//
Asim Shankar7a721752014-08-02 14:27:23 -070010// 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 Sivakumard308c7e2014-10-03 12:46:50 -070014// 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 Shankar61071792014-07-22 13:03:18 -070019type OAuthBlesser interface {
Asim Shankar7a721752014-08-02 14:27:23 -070020 // BlessUsingAccessToken uses the provided access token to obtain the email
Ankur3c33d422014-10-09 11:53:25 -070021 // address and returns a blessing along with the email address.
Asim Shankarb3a82ba2014-10-29 11:41:27 -070022 BlessUsingAccessToken(token string) (blessing security.WireBlessings, email string, err error)
Jiri Simsa519c5072014-09-17 21:37:57 -070023}
Suharsh Sivakumard308c7e2014-10-03 12:46:50 -070024
25// MacaroonBlesser returns a blessing given the provided macaroon string.
26type MacaroonBlesser interface {
27 // Bless uses the provided macaroon (which contains email and caveats)
28 // to return a blessing for the client.
Asim Shankarb3a82ba2014-10-29 11:41:27 -070029 Bless(macaroon string) (blessing security.WireBlessings, err error)
Suharsh Sivakumard308c7e2014-10-03 12:46:50 -070030}