Merge "JUNITS for JSONDELETE class"
[music.git] / docs / authentication.rst
1 Authentication
2 ==============
3
4 `Single-Site Install`_
5
6 `Multi-Site Install`_
7
8 `Headers`_
9
10 `AAF Authentication`_
11
12 `AID Authentication Non-AAF`_
13
14 `Onboarding API`_
15
16  `Add Application`_
17
18  `Get Application`_
19
20  `Edit Application`_
21
22  `Delete Application`_
23
24
25 Steps to test AAF MUSIC has been enhanced to support applications which are already authenticated using AAF and applications which are not authenticated using AAF.
26
27 If an application has already been using AAF, it should have required namespace, userId and password.
28
29 **Non AAF applications (AID)** Works just like AAF but Namespace is an app name and MUSIC manages the User instead of AAF
30
31 All the required params should be sent as headers.
32
33 Changed in Cassandra: Admin needs to create the following keyspace and table.
34
35 In the cassandra bin dir run ./cqlsh and log in to db then:
36
37 If you want to save the following in a file you can then run ./cqlsh -f <file.cql>
38
39 Single-Site Install
40 ^^^^^^^^^^^^^^^^^^^
41 ::
42
43   //Create Admin Keyspace
44    
45   CREATE KEYSPACE admin
46     WITH REPLICATION = {
47       'class' : 'SimpleStrategy',
48       'replication_factor': 1
49     } 
50   AND DURABLE_WRITES = true;
51  
52     CREATE TABLE admin.keyspace_master (
53      uuid uuid,
54      keyspace_name text,
55      application_name text,
56      is_api boolean,
57      password text,
58      username text,
59      is_aaf boolean,
60      PRIMARY KEY (uuid)
61     );
62
63
64 Multi-Site Install
65 ^^^^^^^^^^^^^^^^^^^
66
67 ::
68
69   //Create Admin Keyspace
70  
71   CREATE KEYSPACE admin
72   WITH REPLICATION = {
73     'class' : 'NetworkTopologyStrategy',
74     'DC1':2
75   }
76   AND DURABLE_WRITES = true;
77  
78   CREATE TABLE admin.keyspace_master (
79    uuid uuid,
80    keyspace_name text,
81    application_name text,
82    is_api boolean,
83    password text,
84    username text,
85    is_aaf boolean,
86    PRIMARY KEY (uuid)
87  );
88
89 Headers
90 ^^^^^^^^
91
92 For AAF applications all the 3 headers ns, userId and password are mandatory.
93
94 For Non AAF applications if aid is not provided MUSIC creates new random unique UUID and returns to caller.
95
96 Caller application then need to save the UUID and need to pass the UUID to further modify/access the keyspace.
97
98 Required Headers
99
100 AAF Authentication
101 ^^^^^^^^^^^^^^^^^^
102 ::
103
104   Key     : Value        : Description 
105   ns      : org.onap.aaf : AAF Namespace
106   userId  : username     : USer Id
107   password: password     : Password of User
108
109 AID Authentication Non-AAF
110 ^^^^^^^^^^^^^^^^^^^^^^^^^^
111
112 ::
113
114   Key     : Value        : Description 
115   ns      : App Name     : App Name
116   userId  : username     : Username for this user (Required during Create keyspace Only)
117   password: password     : Password for this user (Required during Create keyspace Only)
118
119 Onboarding API
120 ^^^^^^^^^^^^^^
121
122 Add Application
123 ^^^^^^^^^^^^^^^
124
125 ::
126
127   POST URL: /MUSIC/rest/v2/admin/onboardAppWithMusic  with JSON as follows:
128
129   {
130    "appname": "<the Namespace for aaf or the Identifier for the specific app using AID access",
131    "userId" : "<userid>",
132    "isAAF"  : true/false,
133    "password" : ""
134  }
135   
136 Get Application
137 ^^^^^^^^^^^^^^^
138
139 ::
140
141   POST URL: /MUSIC/rest/v2/admin/search  with JSON as follows:
142
143   {
144    "appname": "<the Namespace for aaf or the Identifier for the specific app using AID access",
145    "isAAF"  : true/false,
146    "aid" : "Unique ID for this user"
147   }
148   
149 Edit Application
150 ^^^^^^^^^^^^^^^^
151
152 ::
153
154   PUT URL: /MUSIC/rest/v2/admin/onboardAppWithMusic  with JSON as follows: 
155
156   {
157   "aid" : "Unique ID for this user",
158   "appname": "<the Namespace for aaf or the Identifier for the specific app using AID access",
159   "userId" : "<userid>",
160   "isAAF"  : true/false,
161   "password" : ""
162   }
163   
164 Delete Application
165 ^^^^^^^^^^^^^^^^^^
166
167 ::
168
169   DELETE URL: /MUSIC/rest/v2/admin/onboardAppWithMusic  with JSON as follows:
170
171  {
172  "aid" : "Unique ID for this app"
173  }