Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@tool @tool_oauth2 @external
2
Feature: Basic OAuth2 functionality
3
  In order to use them later for authentication or repository plugins
4
  As an administrator
5
  I need to add a manage customised OAuth2 services.
6
 
7
  Background:
8
    Given I log in as "admin"
9
    And I change window size to "large"
10
    And I navigate to "Server > OAuth 2 services" in site administration
11
 
12
  Scenario: Create, edit and delete standard service for Google
13
    Given I press "Google"
14
    And I should see "Create new service: Google"
15
    And I set the following fields to these values:
16
      | Name                       | Testing service                           |
17
      | Client ID                  | thisistheclientid                         |
18
      | Client secret              | supersecret                               |
19
    When I press "Save changes"
20
    Then I should see "Changes saved"
21
    And I should see "Testing service"
22
    And "Allow login" "icon" should exist in the "Testing service" "table_row"
23
    And "Allow services" "icon" should exist in the "Testing service" "table_row"
24
    And "Service discovery successful" "icon" should exist in the "Testing service" "table_row"
25
    And I click on "Configure endpoints" "link" in the "Testing service" "table_row"
26
    And I should see "https://accounts.google.com/.well-known/openid-configuration" in the "discovery_endpoint" "table_row"
27
    And I should see "authorization_endpoint"
28
    And I navigate to "Server > OAuth 2 services" in site administration
29
    And I click on "Configure user field mappings" "link" in the "Testing service" "table_row"
30
    And I should see "firstname" in the "given_name" "table_row"
31
    And I should see "middlename" in the "middle_name" "table_row"
32
    And I navigate to "Server > OAuth 2 services" in site administration
33
    And I click on "Edit" "link" in the "Testing service" "table_row"
34
    And I set the following fields to these values:
35
      | Name                       | Testing service modified                 |
36
    And I press "Save changes"
37
    And I should see "Changes saved"
38
    And I should see "Testing service modified"
39
    And I click on "Delete" "link" in the "Testing service modified" "table_row"
40
    And I should see "Are you sure you want to delete the identity issuer \"Testing service modified\"?"
41
    And I press "Continue"
42
    And I should see "Identity issuer deleted"
43
    And I should not see "Testing service modified"
44
 
45
  Scenario: Create, edit and delete standard service for Microsoft
46
    Given I press "Microsoft"
47
    And I should see "Create new service: Microsoft"
48
    And I set the following fields to these values:
49
      | Name                       | Testing service                           |
50
      | Client ID                  | thisistheclientid                         |
51
      | Client secret              | supersecret                               |
52
    When I press "Save changes"
53
    Then I should see "Changes saved"
54
    And I should see "Testing service"
55
    And "Allow login" "icon" should exist in the "Testing service" "table_row"
56
    And "Allow services" "icon" should exist in the "Testing service" "table_row"
1441 ariadna 57
    And "Service discovery successful" "icon" should exist in the "Testing service" "table_row"
1 efrain 58
    And I click on "Configure endpoints" "link" in the "Testing service" "table_row"
59
    And I should see "authorization_endpoint"
1441 ariadna 60
    And I should see "discovery_endpoint"
61
    And I should see "device_authorization_endpoint"
1 efrain 62
    And I navigate to "Server > OAuth 2 services" in site administration
63
    And I click on "Configure user field mappings" "link" in the "Testing service" "table_row"
1441 ariadna 64
    And I should see "firstname" in the "givenname" "table_row"
65
    And I should see "idnumber" in the "sub" "table_row"
66
    And I should see "email" in the "email" "table_row"
67
    And I should see "lang" in the "locale" "table_row"
1 efrain 68
    And I navigate to "Server > OAuth 2 services" in site administration
69
    And I click on "Edit" "link" in the "Testing service" "table_row"
70
    And I set the following fields to these values:
71
      | Name                       | Testing service modified                 |
72
    And I press "Save changes"
73
    And I should see "Changes saved"
74
    And I should see "Testing service modified"
75
    And I click on "Delete" "link" in the "Testing service modified" "table_row"
76
    And I should see "Are you sure you want to delete the identity issuer \"Testing service modified\"?"
77
    And I press "Continue"
78
    And I should see "Identity issuer deleted"
79
    And I should not see "Testing service modified"
80
 
81
  Scenario: Create, edit and delete standard service for Facebook
82
    Given I press "Facebook"
83
    And I should see "Create new service: Facebook"
84
    And I set the following fields to these values:
85
      | Name                       | Testing service                           |
86
      | Client ID                  | thisistheclientid                         |
87
      | Client secret              | supersecret                               |
88
    When I press "Save changes"
89
    Then I should see "Changes saved"
90
    And I should see "Testing service"
91
    And "Allow login" "icon" should exist in the "Testing service" "table_row"
92
    And "Allow services" "icon" should exist in the "Testing service" "table_row"
93
    And I should see "-" in the "Testing service" "table_row"
94
    And I click on "Configure endpoints" "link" in the "Testing service" "table_row"
95
    And I should see "authorization_endpoint"
96
    And I should not see "discovery_endpoint"
97
    And I navigate to "Server > OAuth 2 services" in site administration
98
    And I click on "Configure user field mappings" "link" in the "Testing service" "table_row"
99
    And I should see "firstname" in the "first_name" "table_row"
100
    And I navigate to "Server > OAuth 2 services" in site administration
101
    And I click on "Edit" "link" in the "Testing service" "table_row"
102
    And I set the following fields to these values:
103
      | Name                       | Testing service modified                 |
104
    And I press "Save changes"
105
    And I should see "Changes saved"
106
    And I should see "Testing service modified"
107
    And I click on "Delete" "link" in the "Testing service modified" "table_row"
108
    And I should see "Are you sure you want to delete the identity issuer \"Testing service modified\"?"
109
    And I press "Continue"
110
    And I should see "Identity issuer deleted"
111
    And I should not see "Testing service modified"
112
 
113
  @javascript
114
  Scenario: Create, edit and delete standard service for Nextcloud
115
    Given I press "Nextcloud"
116
    And I should see "Create new service: Nextcloud"
117
    And I set the following fields to these values:
118
      | Name                       | Testing service                           |
119
      | Client ID                  | thisistheclientid                         |
120
      | Client secret              | supersecret                               |
121
    And I press "Save changes"
122
    And I should see "You must supply a value here."
123
    And I set the following fields to these values:
124
      | Service base URL           | https://dummy.local/nextcloud/            |
125
    When I press "Save changes"
126
    Then I should see "Changes saved"
127
    And I should see "Testing service"
128
    And "Do not allow login" "icon" should exist in the "Testing service" "table_row"
129
    And "Allow services" "icon" should exist in the "Testing service" "table_row"
130
    And I should see "-" in the "Testing service" "table_row"
131
    And I click on "Configure endpoints" "link" in the "Testing service" "table_row"
132
    And I should see "authorization_endpoint"
133
    And I should not see "discovery_endpoint"
134
    And I navigate to "Server > OAuth 2 services" in site administration
135
    And I click on "Configure user field mappings" "link" in the "Testing service" "table_row"
136
    And I should see "username" in the "ocs-data-id" "table_row"
137
    And I navigate to "Server > OAuth 2 services" in site administration
138
    And I click on "Edit" "link" in the "Testing service" "table_row"
139
    And I set the following fields to these values:
140
      | Name                       | Testing service modified                 |
141
    And I press "Save changes"
142
    And I should see "Testing service modified"
143
    And I click on "Delete" "link" in the "Testing service modified" "table_row"
144
    And I should see "Are you sure you want to delete the identity issuer \"Testing service modified\"?"
145
    And I press "Continue"
146
    And I should see "Identity issuer deleted"
147
    And I should not see "Testing service modified"
148
 
149
  Scenario: Create, edit and delete valid custom OIDC service
150
    Given I press "Custom"
151
    And I should see "Create new service: Custom"
152
    And I set the following fields to these values:
153
      | Name                       | Google custom                             |
154
      | Client ID                  | thisistheclientid                         |
155
      | Client secret              | supersecret                               |
156
      | Service base URL           | https://accounts.google.com/              |
157
    When I press "Save changes"
158
    Then I should see "Changes saved"
159
    And I should see "Google custom"
160
    And "Do not allow login" "icon" should exist in the "Google custom" "table_row"
161
    And "Allow services" "icon" should exist in the "Google custom" "table_row"
162
    And "Service discovery successful" "icon" should exist in the "Google custom" "table_row"
163
    And the "src" attribute of "table.admintable th img" "css_element" should contain "favicon.ico"
164
    And I click on "Configure endpoints" "link" in the "Google custom" "table_row"
165
    And I should see "https://accounts.google.com/.well-known/openid-configuration" in the "discovery_endpoint" "table_row"
166
    And I should see "authorization_endpoint"
167
    And I navigate to "Server > OAuth 2 services" in site administration
168
    And I click on "Configure user field mappings" "link" in the "Google custom" "table_row"
169
    And I should see "firstname" in the "given_name" "table_row"
170
    And I should see "middlename" in the "middle_name" "table_row"
171
    And I navigate to "Server > OAuth 2 services" in site administration
172
    And I click on "Edit" "link" in the "Google custom" "table_row"
173
    And I set the following fields to these values:
174
      | Name                       | Google custom modified                     |
175
    And I press "Save changes"
176
    And I should see "Changes saved"
177
    And I should see "Google custom modified"
178
    And I click on "Delete" "link" in the "Google custom modified" "table_row"
179
    And I should see "Are you sure you want to delete the identity issuer \"Google custom modified\"?"
180
    And I press "Continue"
181
    And I should see "Identity issuer deleted"
182
    And I should not see "Google custom modified"
183
 
184
  Scenario: Create, edit and delete invalid custom OIDC service
185
    Given I press "Custom"
186
    And I should see "Create new service: Custom"
187
    And I set the following fields to these values:
188
      | Name                       | Invalid custom service                    |
189
      | Client ID                  | thisistheclientid                         |
190
      | Client secret              | supersecret                               |
191
      | Service base URL           | http://dc.imsglobal.org/                 |
192
    When I press "Save changes"
193
    Then I should see "For security reasons only https connections are allowed, sorry"
194
    And I set the following fields to these values:
195
      | Service base URL           | https://dc.imsglobal.org/                 |
196
    And I press "Save changes"
197
    And I should see "Could not discover end points for identity issuer: Invalid custom service"
198
    And I should see "URL: https://dc.imsglobal.org/.well-known/openid-configuration"
199
    And "Allow services" "icon" should exist in the "Invalid custom service" "table_row"
200
    And "Do not allow login" "icon" should exist in the "Invalid custom service" "table_row"
201
    And I should see "-" in the "Invalid custom service" "table_row"
202
    And I click on "Configure endpoints" "link" in the "Invalid custom service" "table_row"
203
    And I should not see "discovery_endpoint"
204
    And I navigate to "Server > OAuth 2 services" in site administration
205
    And I click on "Configure user field mappings" "link" in the "Invalid custom service" "table_row"
206
    And I should not see "given_name"
207
    And I should not see "middle_name"
208
    And I navigate to "Server > OAuth 2 services" in site administration
209
    And I click on "Edit" "link" in the "Invalid custom service" "table_row"
210
    And I set the following fields to these values:
211
      | Name                       | Valid custom service                        |
212
      | Service base URL           | https://accounts.google.com/                |
213
    And I press "Save changes"
214
    And "Do not allow login" "icon" should exist in the "Valid custom" "table_row"
215
    And "Allow services" "icon" should exist in the "Valid custom" "table_row"
216
    And I should see "-" in the "Valid custom" "table_row"
217
    And I click on "Edit" "link" in the "Valid custom service" "table_row"
218
    And I set the following fields to these values:
219
      | Name                       | Invalid custom service                    |
220
      | Service base URL           | https://dc.imsglobal.org/                 |
221
    And I press "Save changes"
222
    And I should see "-" in the "Invalid custom service" "table_row"
223
    And I click on "Delete" "link" in the "Invalid custom service" "table_row"
224
    And I should see "Are you sure you want to delete the identity issuer \"Invalid custom service\"?"
225
    And I press "Continue"
226
    And I should see "Identity issuer deleted"
227
    And I should not see "Invalid custom service"
228
 
229
  Scenario: Create, edit and delete empty custom OIDC service
230
    Given I press "Custom"
231
    And I should see "Create new service: Custom"
232
    And I set the following fields to these values:
233
      | Name                       | Empty custom service                      |
234
      | Client ID                  | thisistheclientid                         |
235
      | Client secret              | supersecret                               |
236
    When I press "Save changes"
237
    And I should see "Changes saved"
238
    And I should see "Empty custom service"
239
    And "Allow services" "icon" should exist in the "Empty custom service" "table_row"
240
    And "Do not allow login" "icon" should exist in the "Empty custom service" "table_row"
241
    And I should see "-" in the "Empty custom service" "table_row"
242
    And I click on "Configure endpoints" "link" in the "Empty custom service" "table_row"
243
    And I should not see "discovery_endpoint"
244
    And I navigate to "Server > OAuth 2 services" in site administration
245
    And I click on "Configure user field mappings" "link" in the "Empty custom service" "table_row"
246
    And I should not see "given_name"
247
    And I should not see "middle_name"
248
    And I navigate to "Server > OAuth 2 services" in site administration
249
    And I click on "Edit" "link" in the "Empty custom service" "table_row"
250
    # Check it works as expected too without slash at the end of the service base URL.
251
    And I set the following fields to these values:
252
      | Name                       | Valid custom service                      |
253
      | Service base URL           | https://accounts.google.com               |
254
    And I press "Save changes"
255
    And "Do not allow login" "icon" should exist in the "Valid custom" "table_row"
256
    And "Allow services" "icon" should exist in the "Valid custom" "table_row"
257
    And I should see "-" in the "Valid custom" "table_row"
258
    And I click on "Edit" "link" in the "Valid custom service" "table_row"
259
    And I set the following fields to these values:
260
      | Name                       | Invalid custom service                    |
261
      | Service base URL           | https://dc.imsglobal.org/                 |
262
    And I press "Save changes"
263
    And I should see "-" in the "Invalid custom service" "table_row"
264
    And I click on "Edit" "link" in the "Invalid custom service" "table_row"
265
    And I set the following fields to these values:
266
      | Name                       | Empty custom service                      |
267
      | Service base URL           |                                           |
268
    And I press "Save changes"
269
    And I should see "Changes saved"
270
    And I should see "Empty custom service"
271
    And I click on "Delete" "link" in the "Empty custom service" "table_row"
272
    And I should see "Are you sure you want to delete the identity issuer \"Empty custom service\"?"
273
    And I press "Continue"
274
    And I should see "Identity issuer deleted"
275
    And I should not see "Empty custom service"
276
 
277
  Scenario: Create a standard service for Google and test form and UI for login only, services only and both
278
    Given I press "Google"
279
    And I should see "Create new service: Google"
280
    # Create using 'Login page only' option.
281
    And I set the following fields to these values:
282
      | Name                       | Testing service                           |
283
      | Client ID                  | thisistheclientid                         |
284
      | Client secret              | supersecret                               |
285
      | This service will be used  | Login page only                           |
286
    When I press "Save changes"
287
    Then I should see "Changes saved"
288
    And I should see "Testing service"
289
    And "Allow login" "icon" should exist in the "Testing service" "table_row"
290
    And "Do not allow services" "icon" should exist in the "Testing service" "table_row"
291
    And "Service discovery successful" "icon" should exist in the "Testing service" "table_row"
292
    # Change to 'Internal services only'.
293
    And I click on "Edit" "link" in the "Testing service" "table_row"
294
    And I set the following fields to these values:
295
      | This service will be used  | Internal services only                     |
296
    And I press "Save changes"
297
    And I should see "Changes saved"
298
    And "Do not allow login" "icon" should exist in the "Testing service" "table_row"
299
    And "Allow services" "icon" should exist in the "Testing service" "table_row"
300
    # Change to 'Login page and internal services' and add a display name.
301
    And I click on "Edit" "link" in the "Testing service" "table_row"
302
    And I set the following fields to these values:
303
      | This service will be used         | Login page and internal services     |
304
      | Name displayed on the login page  | Google new display name              |
305
    And I press "Save changes"
306
    And I should see "Changes saved"
307
    And "Allow login" "icon" should exist in the "Testing service" "table_row"
308
    And "Allow services" "icon" should exist in the "Testing service" "table_row"
309
    And I should see "Google new display name" in the "Testing service" "table_row"
310
 
311
  Scenario: Create a login page only custom OIDC service
312
    Given I press "Custom"
313
    And I should see "Create new service: Custom"
314
    And I set the following fields to these values:
315
      | Name                              | Empty custom service                      |
316
      | Client ID                         | thisistheclientid                         |
317
      | Client secret                     | supersecret                               |
318
      | This service will be used         | Login page only                           |
319
      | Name displayed on the login page  | Custom display name                       |
320
    When I press "Save changes"
321
    And I should see "Changes saved"
322
    And I should see "Empty custom service"
323
    And I should see "Custom display name" in the "Empty custom service" "table_row"
324
    And "Not configured" "icon" should exist in the "Empty custom service" "table_row"
325
    And "Do not allow services" "icon" should exist in the "Empty custom service" "table_row"
326
    And I click on "Configure endpoints" "link" in the "Empty custom service" "table_row"
327
    And I press "Create new endpoint for issuer \"Empty custom service\""
328
    And I set the following fields to these values:
329
      | Name | userinfo_endpoint |
330
      | URL  | https://example.com/userinfo |
331
    And I press "Save changes"
332
    And I navigate to "Server > OAuth 2 services" in site administration
333
    And "Allow login" "icon" should exist in the "Empty custom service" "table_row"
334
    And "Do not allow services" "icon" should exist in the "Empty custom service" "table_row"
335
 
336
  @javascript
337
  Scenario: Changes to "Authenticate token requests via HTTP headers" are saved
338
    Given I press "Custom"
339
    And I set the following fields to these values:
340
      | Name                              | Custom service                     |
341
      | Client ID                         | thisistheclientid                  |
342
      | Client secret                     | supersecret                        |
343
    And I press "Save changes"
344
    When I click on "Edit" "link" in the "Custom service" "table_row"
345
    And I click on "Authenticate token requests via HTTP headers" "checkbox"
346
    And I press "Save changes"
347
    And I click on "Edit" "link" in the "Custom service" "table_row"
348
    And the field "Authenticate token requests via HTTP headers" matches value "1"
349
    And I click on "Authenticate token requests via HTTP headers" "checkbox"
350
    And I press "Save changes"
351
    And I click on "Edit" "link" in the "Custom service" "table_row"
352
    Then the field "Authenticate token requests via HTTP headers" matches value ""