Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: mojo/services/vanadium/security/interfaces/principal.mojom

Issue 1418013004: Principal Service: Add support for multiple user accounts (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved. Use of this
2 // Use of this source code is governed by a BSD-style license that can be 2 // source code is governed by a BSD-style license that can be found in the
3 // found in the LICENSE file. 3 // LICENSE file.
4 4
5 module vanadium; 5 module vanadium;
6 6
7 // Represents the name of an application. |url| is the url of the 7 // Represents the name of an application. |url| is the url of the application.
8 // application. |qualifier| is a string that allows to tie a specific 8 // |qualifier| is a string that allows to tie a specific instance of an
9 // instance of an application to another. 9 // application to another.
10 struct AppInstanceName { 10 struct AppInstanceName {
11 string url; 11 string url;
12 string? qualifier; 12 string? qualifier;
13 }; 13 };
14 14
15 // Certificate represents a human-readable name and public-key (DER encoded) pai r. 15 // Represents a user identity. |email| is the email address of the user, which m ay
16 // The private-key for a certificate is only available for signing operations 16 // be obtained through a third-party authentication flow (e.g., oauth2).
17 // within the principal service application. 17 struct User {
18 struct Certificate { 18 string email;
19 string extension; 19 // TODO(ataly, ukode): Include the name of the identity provider?
20 array<uint8>? publickey; 20 // TODO(ataly, ukode): Include the first and last name of the user?
21 // TODO(ataly, ukode): Include any unique ids assigned to the user by the
22 // identity provider?
21 }; 23 };
22 24
23 // Blessing is a credential binding a user identity to a public key. The corresp onding 25 // Certificate represents a human-readable name and public-key (DER encoded)
24 // private key is only available for signing within the PrincipalService applica tion. 26 // pair. The private-key for a certificate is only available for signing
25 struct Blessing { 27 // operations within the principal service application.
26 array<Certificate> chain; 28 struct Certificate {
29 string extension;
30 array<uint8>? publickey;
27 }; 31 };
28 32
29 // ChainSeparator is the separator used to join name extensions in a certificate chain. 33 // Blessing is a credential binding a user identity to a public key. The
34 // corresponding private key is only available for signing within the
35 // PrincipalService application.
36 // TODO(ataly, gauthamt): This Blessing type does not match the Vanadium
37 // WireBlessing type. For the blessing to be usable by SyncBase we will have
38 // to make it match the WireBlessing type.
39 struct Blessing {
40 array<Certificate> chain;
41 };
42
43 // ChainSeparator is the separator used to join name extensions in a
44 // certificate chain.
30 const string ChainSeparator = "/"; 45 const string ChainSeparator = "/";
31 46
32 // A service that binds user identities to an application instance running in Mo jo 47 // A service that binds user identities to an application instance running in
48 // Mojo. An application instance may have multiple user identities with one of
49 // them set as the current identity.
33 interface PrincipalService { 50 interface PrincipalService {
34 // Login is called by an application instance (requestor_url/qualifier) that 51 // Login is called by an application instance (requestor_url/qualifier) that
35 // wants to get a user blessing. The service may obtain the user blessing 52 // wants to get a new user identity. The service may obtain the user identity
36 // through a third-party authentication flow (eg:oauth2). The user blessing 53 // through a third-party authentication flow (e.g., oauth2) which may involve
37 // is bound to a public/private key-pair that this service generates and 54 // user intervention. The obtained identity is added to the set of
38 // persists for this application instance. Returns null if login fails. 55 // authenticated user identities of the application instance, and is also set
39 Login() => (Blessing? user_blessing); 56 // as the current user identity for the instance.
57 //
58 // Additionally, the service creates a user blessing that binds the obtained
59 // email address of the user to the unique public/private key-pair of the inst ance.
60 // This key pair is generated and persisted by this service on the first Login
61 // invocation by the application instance. The constructed blessing may be
62 // obtained by invoking GetUserBlessing().
gautham 2015/10/26 20:52:01 remove ()
ataly 2015/10/28 21:32:24 Done.
63 //
64 // Returns the user identifier or null if an error is encountered at any
65 // stage.
66 Login() => (User? user);
40 67
41 // Removes the user blessing for the application instance that invokes the 68 // GetUsers returns all authenticated user identities and the current user
42 // Logout method. 69 // identity of the calling application instance. The user identities are a
70 // result of previous Login() calls by the instance.
71 //
72 // The current user identity may be null if the instance is in logged out
73 // state (see 'Logout').
74 GetUsers() => (array<User> ids, User? current);
75
76 // SetCurrentUser sets the provided identity as the current user identity of
77 // the calling application instance. The provided identity must be present in
78 // the set of authenticated user identities for the application instance,
79 // otherwise an error is returned.
80 SetCurrentUser(User user) => (string? error);
gautham 2015/10/26 20:52:01 I know we discussed this. I'm wondering whether we
ataly 2015/10/28 21:32:24 Yes, we can definitely go in this direction (i.e.,
81
82 // Logout sets the current user identity of the calling application instance
83 // to null.
43 Logout(); 84 Logout();
44 85
45 // GetUserBlessing returns the user blessing for a given application instance. 86 // GetUser returns the current user identity for a given application instance.
46 // It returns an error if the application instance has not invoked Login(). 87 // If a null application instance is provided then the current user blessing o f
47 GetUserBlessing(AppInstanceName app) => (Blessing? user_blessing); 88 // the calling application instance is returned.
89 //
90 // Returns null if the application instance has not invoked Login().
91 GetUser(AppInstanceName? app) => (User? user);
92
93 // GetUserBlessing returns the current user blessing for a given application
94 // instance. If a null application instance is provided then the current user
95 // blessing of the calling application instance is returned.
96 //
97 // Returns null if the application instance has not invoked Login().
98 GetUserBlessing(AppInstanceName? app) => (Blessing? user_blessing);
gautham 2015/10/26 20:52:01 Any reason why User, Blessing are not part of the
ataly 2015/10/28 21:32:24 Done.
48 }; 99 };
49
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698