15577: Documentation updates WIP
[arvados.git] / doc / admin / activation.html.textile.liquid
1 ---
2 layout: default
3 navsection: admin
4 title: User activation
5 ...
6
7 {% comment %}
8 Copyright (C) The Arvados Authors. All rights reserved.
9
10 SPDX-License-Identifier: CC-BY-SA-3.0
11 {% endcomment %}
12
13 This page describes how new users are created and activated.
14
15 "Browser login and management of API tokens is described here.":{{site.baseurl}}/api/tokens.html
16
17 h3. Authentication
18
19 After completing the authentication process, a callback is made from the SSO server to the API server, providing a user record and @identity_url@ (despite the name, this is actually an Arvados user uuid).
20
21 The API server searches for a user record with the @identity_url@ supplied by the SSO.  If found, that user account will be used, unless the account has @redirect_to_user_uuid@ set, in which case it will use the user in @redirect_to_user_uuid@ instead (this is used for the "link account":{{site.baseurl}}/user/topics/link-accounts.html feature).
22
23 Next, it searches by email address for a "pre-activated account.":#pre-activated
24
25 If no existing user record is found, a new user object will be created.
26
27 A federated user follows a slightly different flow, whereby a special token is presented and the API server verifies user's identity with the home cluster, however it also results in a user object (representing the remote user) being created.
28
29 h3. User setup
30
31 If @Users.AutoSetupNewUsers@ is true, as part of creating the new user object, the user is immediately set up with:
32
33 * @can_login@ @permission@ link going (email address → user uuid) which records @identity_url_prefix@
34 * Membership in the "All users" group (can read all users, all users can see new user)
35 * A new git repo and @can_manage@ permission to that repo if @Users.AutoSetupNewUsersWithRepository@ is true
36 * @can_login@ permission to a shell node if @Users.AutoSetupNewUsersWithVmUUID@ is set to the uuid of a vm
37
38 Otherwise, an admin must explicitly invoke "setup" on the user via workbench or the API.
39
40 h3. User activation
41
42 A newly created user is inactive (@is_active@ is false) unless explicitly set by the admin.
43
44 An inactive user cannot create or update any object, but can read Arvados objects that the user account has permission to read.  As a result, when @Users.AutoSetupNewUsers@ is true, an user who has been set up but is not activate may still be able to do things, such as read things shared with "All users", clone and push to the git repository, or login to a VM.
45
46 {% comment %}
47 Maybe these services should check is_active.
48
49 I believe that when this was originally designed, being able to access git and VM required an ssh key, and an inactive user could not register an ssh key because that required creating a record.  However, it is now possible to authenticate to shell VMs and http+git with just an API token.
50 {% endcomment %}
51
52 There are three ways a user can be activated.
53
54 # Self-activation by Workbench.  When an inactive user logs, Workbench attempts to self-activate.  Successful activation creates the git repo and vm login for the user.
55 # An admin can invoke the @activate@ method of the users controller using @arv user activate --uuid=...@
56 # An admin can set the @is_active@ field directly.  This runs @setup_on_activate@ which sets up oid_login_perm and group membership, but does not set repo or vm (even if if @Users.AutoSetupNewUsersWithRepository@ and/or @Users.AutoSetupNewUsersWithVmUUID@ are set).  The admin can invoke "setup" separately (or use the "Setup" button on Workbench).
57
58 h3(#deactivating_users). Deactivate a user
59
60 Setting @is_active@ to @false@ is not sufficient to lock out a user.  The user may be able to use re-activate themself.  The correct way is to use @unsetup@.
61
62 Note: also make sure that @is_admin: false@.  If the user still has @is_admin: true@ the user may be able to re-activate themself.
63
64 <pre>
65 $ arv user unsetup --uuid=x1u39-tpzed-3kz0nwtjehhl0u4
66 </pre>
67
68 * Delete oid_login_perms
69 * Delete git repository permission links
70 * Delete VM login permission links
71 * Remove access to "All users" group
72 * Delete any user agreement signatures
73 * Clear preferences / profile
74 * Mark as inactive
75
76 Unsetup does not revoke API tokens.
77
78 An "inactive" user with a valid API token can still read the database, but is barred from creating or modifying records.  User deactivation with "unsetup" should be done together with "ownership reassignment.":reassign-ownership.html
79
80 h3(#user_agreements). User agreements
81
82 The @activate@ method of the users controller checks if the user @is_invited@ and whether the user has "signed" all the user agreements.
83
84 @is_invited@ is true if any of these are true:
85 * @is_active@ is true
86 * @Users.NewUsersAreActive@ is true
87 * The user account has permission to view the membership of the "All Users" group.
88
89 User agreements are accessed by getting a listing on the @user_agreements@ endpoint.  This returns a list of collection uuids.  This is executed as a system user, so it bypasses normal read permission checks.
90
91 The available user agreements are represented in the Links table as
92
93 <pre>
94 {
95   "link_class": "signature",
96   "name": "require",
97   "tail_uuid": "*system user uuid*",
98   "head_uuid: "*collection uuid*"
99 }
100 </pre>
101
102 The collection contains the user agreement text file.
103
104 On workbench, it checks @is_invited@.  If true, it displays the clickthrough agreements which the user can "sign".  If @is_invited@ is false, the user ends up at the "inactive user" page.
105
106 The @user_agreements/sign@ endpoint creates a Link object:
107
108 <pre>
109 {
110   "link_class": "signature"
111   "name": "click",
112   "tail_uuid": "*user uuid*",
113   "head_uuid: "*collection uuid*"
114 }
115 </pre>
116
117 This is executed as a system user, so it bypasses the restriction that inactive users cannot create objects.
118
119 The @user_agreements/signatures@ endpoint returns the list of Link objects that represent signatures by the current user (created by @sign@).
120
121 h3. User profile
122
123 The user profile is checked by workbench after checking if user agreements need to be signed.  The requirement to fill out the user profile is not enforced by the API server.
124
125 h3(#pre-activated). Pre-activate user by email address
126
127 You may create a user account for a user that has not yet logged in, and identify the user by email address.
128
129 1. As an admin, create a user object:
130
131 <pre>
132 $ arv user create --user '{"email": "foo@example.com", "username": "barney", "is_active": true}'
133 </pre>
134
135 2. When the user logs in the first time, the email address will be recognized and the user will be associated with the existing user object.
136
137 h3. Pre-activate federated user
138
139 1. As admin, create a user object with the @uuid@ of the federated user (this is the user's uuid on their home cluster, called @clsr2@ in this example):
140
141 <pre>
142 $ arv user create --user '{"uuid": "clsr2-tpzed-1234567890abcdf", "email": "foo@example.com", "username": "barney", "is_active": true}'
143 </pre>
144
145 2. When the user logs in, they will be associated with the existing user object.
146
147 h3. Auto-activate federated users from trusted clusters
148
149 In the API server config, set @ActivateUsers: true@ for each federated cluster in @RemoteClusters@ .  A federated user from one of the listed clusters which @is_active@ on the home cluster will be automatically set up and activated on this cluster.
150
151 h3. Activation flows
152
153 h4. Private instance
154
155 Policy: users must be manually activated by the admin.
156
157 Here is the configuration for this policy.  This is also the default if not provided.
158 (However, be aware this is not how developer/demo builds such as "arvbox":{{site.baseurl}}/install/arvbox.html are configured.)
159
160 <pre>
161 Users:
162   AutoSetupNewUsers: false
163   NewUsersAreActive: false
164 </pre>
165
166 # User is created.  Not set up.  @is_active@ is false.
167 # Workbench checks @is_invited@ and finds it is false.  User gets "inactive user" page.
168 # Admin goes to user page and clicks either "setup user" or manually @is_active@ to true.
169 # Clicking "setup user" sets up the user.  This includes adding the user to "All users" which qualifies the user as @is_invited@.
170 # On refreshing workbench, the user is still inactive, but is able to self-activate after signing clickthrough agreements (if any).
171 # Alternately, directly setting @is_active@ to true also sets up the user, but workbench won't display clickthrough agreements (because the user is already active).
172
173 h4. Federated instance
174
175 Policy: users other clusters in the federation are activated, users from outside the federation must be manually approved.
176
177 Here is the configuration for this policy and an example remote cluster @clsr2@.
178
179 <pre>
180 Users:
181   AutoSetupNewUsers: false
182   NewUsersAreActive: false
183 RemoteClusters:
184   clsr2:
185     ActivateUsers: true
186 </pre>
187
188 # Federated user arrives claiming to be from cluster 'clsr2'
189 # API server authenticates user as being from cluster 'clsr2'
190 # Because 'clsr2' has @ActivateUsers@ the user is set up and activated.
191 # User can immediately start using Workbench.
192
193 h4. Open instance
194
195 Policy: anybody who shows up and signs the agreements is activated.
196
197 <pre>
198 Users:
199   AutoSetupNewUsers: true
200   NewUsersAreActive: false
201 </pre>
202
203 "Set up user agreements":#user_agreements by creating "signature" "require" links as described earlier.
204
205 # User is created and auto-setup.  At this point, @is_active@ is false, but user has been added to "All users" group.
206 # Workbench checks @is_invited@ and finds it is true, because the user is a member of "All users" group.
207 # Workbench presents user with list of user agreements, user reads and clicks "sign" for each one.
208 # Workbench tries to activate user.
209 # User is activated.
210
211 h4. Developer instance
212
213 Policy: avoid wasting developer's time during development/testing.  Insecure.
214
215 <pre>
216 Users:
217   AutoSetupNewUsers: true
218   NewUsersAreActive: true
219 </pre>
220
221 # User is created, immediately auto-setup, and auto-activated.
222 # User can immediately start using workbench.