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

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
« no previous file with comments | « examples/bank_app/customer.cc ('k') | services/vanadium/security/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
16 // The private-key for a certificate is only available for signing operations 16 // may 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 Blessing blessing;
20 array<uint8>? publickey; 20 // TODO(ataly, ukode): Include the name of the identity provider?
21 // TODO(ataly, ukode): Include the first and last name of the user?
22 // TODO(ataly, ukode): Include any unique ids assigned to the user by the
23 // identity provider?
21 }; 24 };
22 25
23 // Blessing is a credential binding a user identity to a public key. The corresp onding 26 // Certificate represents a human-readable name and public-key (DER encoded)
24 // private key is only available for signing within the PrincipalService applica tion. 27 // pair. The private-key for a certificate is only available for signing
25 struct Blessing { 28 // operations within the principal service application.
26 array<Certificate> chain; 29 struct Certificate {
30 string extension; 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. A detailed decription of the blessings concept
36 // can be found at:
37 // https://github.com/vanadium/docs/blob/master/concepts/security.md
38 // TODO(ataly, gauthamt): This Blessing type does not match the Vanadium
39 // WireBlessing type. For the blessing to be usable by SyncBase we will have to
40 // make it match the WireBlessing type.
41 struct Blessing {
42 array<Certificate> chain;
43 };
44
45 // ChainSeparator is the separator used to join name extensions in a
46 // certificate chain.
30 const string ChainSeparator = "/"; 47 const string ChainSeparator = "/";
31 48
32 // A service that binds user identities to an application instance running in Mo jo 49 // A service that binds user identities to an application instance running in
50 // Mojo. An application instance may have multiple user identities with one of
51 // them set as the current identity.
33 interface PrincipalService { 52 interface PrincipalService {
34 // Login is called by an application instance (requestor_url/qualifier) that 53 // 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 54 // 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 55 // 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 56 // user intervention. The obtained identity is added to the set of
38 // persists for this application instance. Returns null if login fails. 57 // authenticated user identities of the application instance, and is also set
39 Login() => (Blessing? user_blessing); 58 // as the current user identity for the application instance.
59 //
60 // Additionally, the service creates a user blessing that binds the obtained
61 // email address of the user to the unique public/private key-pair of the
62 // application instance.
63 //
64 // Returns the user identity or null if an error is encountered at any stage.
65 Login() => (User? user);
40 66
41 // Removes the user blessing for the application instance that invokes the 67 // Logout sets the current user identity of the calling application instance
42 // Logout method. 68 // to null.
43 Logout(); 69 Logout();
44 70
45 // GetUserBlessing returns the user blessing for a given application instance. 71 // GetUser returns the current user identity for a given application
46 // It returns an error if the application instance has not invoked Login(). 72 // instance. If a null application instance is provided then the current
47 GetUserBlessing(AppInstanceName app) => (Blessing? user_blessing); 73 // user identity of the calling application instance is returned.
74 //
75 // Returns null if the application instance has not invoked Login or if the
76 // instance is in logged out state (see 'Logout').
77 GetUser(AppInstanceName? app) => (User? user);
78
79 // SetUser sets the current user identity of the calling application
80 // instance. The provided identity must be present in the set of logged-in
81 // user identities for the application instance, otherwise an error is
82 // returned.
83 SetUser(User user) => (string? error);
84
85 // GetLoggedInUsers returns all authenticated user identities of the calling
86 // application instance. The user identities are a result of previous Login
87 // calls by the application instance.
88 GetLoggedInUsers() => (array<User> ids);
48 }; 89 };
49
OLDNEW
« no previous file with comments | « examples/bank_app/customer.cc ('k') | services/vanadium/security/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698