92d4a979eefd4097af71e8ba2f6b24c1c9612d62
[devwiki.git] / design / revisedclientarchitecture.mdwn
1 ## Revised Client Architecture
2
3 The architecture of the initial implementation needs to be re-factored to with give better Model, View, Controller separation, allowing for:
4
5 - more ways of interacting with the server than the ID Selector App and Web Provisioning;
6 - different storage strategies;
7 - ease of maintenance.
8
9 Specific requirements from the Statement of Work are
10
11     6.1 Abstract the interface between the Identity Selector and its backend datastore.
12         This is required to allow different such datastores to be used at will (e.g. Gnome 
13         Keyring, Mac Keychain, etc).
14
15     6.2 Abstract the interface between the core logical component of the Identity Selector 
16         and the current UI elements. This is required to enable other interfaces to the Identity
17         Selector to work, such as a platform specific UI or a Command Line Interface to enable 
18         headless operation. Any policy or invariant or constraint logic currently independent of 
19         the core logical component must be abstracted into the core so that no matter what 
20         backend datastore or UI frontend is used, all policy or invariant or constraint logic is
21         always used and enforced.
22
23 ### Overview
24
25 This diagram shows the proposed new architecture.
26 ![image](https://gitorious.org/petefoth-public-docs/petefoth-public-docs/blobs/raw/master/Moonshot/Proposed%20New%20Architecture.jpg)
27
28 The re-factored Moonshot Client software will have the following components:
29
30 *_identity-manager-app_* a GUI application allowing the User to manage identities which are provisioned on the client machine usign the APIs provided by:
31
32 *_identity-selector-ui-lib_* a shared library offering C and Vala APIs allowing applications to access the identities which are provisioned on the client machine in order to access internet services. 
33
34 *_identity-lib_* a shared library offering C and Vala APIs providing Create / Read / Update / Delete functionality for Identities. It is the only means of accessing the _identity-storage-server_.
35
36 *_identity-storage-server_*  encapsulates the Identity Store in a library offering a CRUD API to access the store.
37
38 - is accessed directly only by _identity-lib_. 
39 - it protects the store from multiple concurrent write accesses
40 - re-implemented per platform and per storage strategy so
41
42   * one version each for Linux, Mac OS and Windows, local storage. DBus provides an appropriate mechanism under Linux (and possibly Mac OS X) for protecting the store from multiple concurrent write access. DBus is not supported on Windows, so the Windows implementation will use a different mechanism. This version will re-use storage-related code from src/moonshot-window.vala etc. The Mac implementation will either use DBus, or it will use the Mac OS X Keychain to store identities (see mailing list thread beginning [here](https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1112&L=MOONSHOT-COMMUNITY&F=&S=&X=2C162240A9A66326F2&P=3272)).
43   * one version for web storage, restful API. (Not in scope for this iteration).
44   * other versions as required for different storage solutions  (Not in scope for this iteration).
45
46 *_identity-provisioning_* - not implemented in the initial implementation. Provides CRUD operations via (for now) .msht and XML files, and via command line. Implemented in portable code as far as possible. Uses *_identity-lib_*. Consists of
47
48 - *_identity-provisioning-file-handler_* - processes .msht (and, in future iterations, json, and maybe other format) files for file-based provisioning operations. Currently implemented as *_moonshot-webp_*, allowing only install access. In future iterations it will also allow uninstall/revoke access. .msht is an an XML-based file format. The MIME type 'application/moonshot+xml'. An association is created on install so that these files are automatically opened by _identity-provisioning-file-handler_ when clicked.
49
50 - *_identity-provisioning-cli-handler_* - provides a command line API to identity CRUD functions
51
52 All of the components will be implemented in Vala. 
53
54 ### Detail _identity-selector-ui-lib_ component
55
56 Implemented as a shared library in Vala. Built with the -H option to enable access from C code, and introspection generated to allow use from other languages.
57
58 Provides APIs which can be used by _identity-manager-app_, by _identity-provisioning_ components needing to interact with the user, and other applications which need to interact with the user in selecting the identity they will use to access an internet service. These are the APIs provided by _libmoonshot_ in the initial implementation.
59
60 It *uses* APIs provided by _identity-lib_ to access the Identity store.
61
62 Implemented in Vala using GTK widgets, reusing code from src/moonshot-window.vala and other UI related code..
63
64 ### Detail _identity-lib_ component
65
66 Implemented as a shared library in Vala. Built with the -H option to enable access from C code, and introspection generated to allow use from other languages.
67
68 Owns the public APIs for accessing the Identity Store (rather than, as in the initial implementation, exposing the APIs provided via DBus by _moonshot-ui_).
69
70 Provides equivalent APIs to those provided by _identity-selector-ui-lib_ (and in the initial implementation by _lib-moonshot_) but with no UI. It is used
71
72 - by _identity-selector-ui-lib_ ;
73 - by other applications to obtain the identities they need to access internet services *without interacting with the user*;
74 - by _identity-provisioning_ components to provision identities *without interacting with the user*.
75
76 Provides new APIs needed by _identity-selector-ui-lib_ and _identity-provisioning_ components, to manage identities (e.g. CreateNewIdCard(), UpdateIdCard(), DeleteIdCard()).
77
78 Uses the APIs provided by the *_identity-storage-server_* component (_-dbus-local-storage-server_ on Linux and Mac, _-windows-local-storage-server_ on Windows).
79
80 It has no UI, so that it can be used in circumstances where interaction with a user is not possible (e.g. in headless servers). Any needed interaction with the User is done by client software.
81
82 ### Detail _identity_manager_app_ component
83 This app provides a UI allowing the USer to manage their stored identities.
84  
85
86 ### Detail _identity-provisioning_ component
87
88 The *_identity-provisioning-file-handler_* component replaces the moonshot-webp component. It provides the same InstallIdentityCard() functionality as the moonshot-webp component in the initial implementation. In future iterations, it will provide new functions to uninstall and revoke identities. 
89
90 The *_identity-provisioning-cli-handler_* component is not part of the current iteration. In a future iterations it is intended to provide via the command line the same functionality as *_identity-provisioning-file-handler_* but without requiring any interaction with the user.
91
92 ### Use Case Implementation
93
94 The re-factored software is designed to implement the following use cases that were part of the initial implementation:
95
96 1. User installs and identity by clicking on a .msht file downloaded from the Web
97 1. User creates and installs an identity card using the UI
98 1. User modifies an existing identity card using the UI
99 1. User deletes an existing identity card using the UI
100
101 It is designed to extend the above Uses cases as follows:
102
103 1. User can install .msht files when attached to emails
104 1. User can use .msht files to delete or revoke identities
105 1. User can create, view, update and delete installed identities via the command line
106 1. User can create, view, update and delete installed identities using a script file
107
108 Not all of these will be implemented in the current phase, but the software will be implemented in a way that facilitates their implementation in future phases.
109