Proyectos de Subversion Moodle

Rev

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