blob: 5dd2891619568c08d910605756eaa04ffc6b2e3b [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
4
Asim Shankar7a721752014-08-02 14:27:23 -07005// 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 Shankar61071792014-07-22 13:03:18 -07008//
Asim Shankar7a721752014-08-02 14:27:23 -07009// 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 Simsa519c5072014-09-17 21:37:57 -070024// import "veyron.io/veyron/veyron2/security/wire"
Asim Shankar61071792014-07-22 13:03:18 -070025type OAuthBlesser interface {
Asim Shankar7a721752014-08-02 14:27:23 -070026 // 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 Simsa519c5072014-09-17 21:37:57 -070037}