You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 25, 2021. It is now read-only.
- always return index if a path cannot be met
- security tests to ensure index is protected
Contributes to: #154
Signed-off-by: Nic Townsend <[email protected]>
Copy file name to clipboardExpand all lines: server/client/client.feature
+68-38Lines changed: 68 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -4,45 +4,75 @@ Feature: client module
4
4
5
5
Behaviours and capabilities provided by the client module
6
6
7
-
Scenario Outline: If no <Asset> asset can be served, the client module returns 404
8
-
Given a 'client_only' server configuration
9
-
And There are no files to serve
10
-
And Authentication is required
11
-
And I run an instance of the Strimzi-UI server
12
-
When I make a 'get' request to '<Asset>'
13
-
Then I get the expected status code '<StatusCode>' response
7
+
Scenario Outline:With auth '<Auth>' - If no <Asset> asset can be served, the client module returns 404
8
+
Given a 'client_only' server configuration
9
+
And There are no files to serve
10
+
And '<Auth>' authentication is required
11
+
And I run an instance of the Strimzi-UI server
12
+
When I make a 'get' request to '<Asset>'
13
+
Then I get the expected status code '<StatusCode>' response
14
14
15
-
Examples:
16
-
| Asset | StatusCode |
17
-
| /index.html | 404 |
18
-
| /images/picture.svg | 404 |
19
-
| /doesnotexist.html | 404 |
20
-
| /someroute | 404 |
21
-
| /protected.html | 404 |
22
-
| / | 404 |
15
+
Examples:
16
+
| Asset | Auth | StatusCode |
17
+
| /index.html | scram | 404 |
18
+
| /images/picture.svg | scram | 404 |
19
+
| /doesnotexist.html | scram | 404 |
20
+
| /someroute | scram | 404 |
21
+
| /protected.html | scram | 404 |
22
+
| / | scram | 404 |
23
+
| /index.html | oauth | 404 |
24
+
| /images/picture.svg | oauth | 404 |
25
+
| /doesnotexist.html | oauth | 404 |
26
+
| /someroute | oauth | 404 |
27
+
| /protected.html | oauth | 404 |
28
+
| / | oauth | 404 |
29
+
| /index.html | none | 404 |
30
+
| /images/picture.svg | none | 404 |
31
+
| /doesnotexist.html | none | 404 |
32
+
| /someroute | none | 404 |
33
+
| /protected.html | none | 404 |
34
+
| / | none | 404 |
23
35
24
-
Scenario Outline: If assets can be served, the client module returns the appropriate <StatusCode> return code for a request of <Asset>
25
-
Given a 'client_only' server configuration
26
-
And There are files to serve
27
-
And Authentication is required
28
-
And I run an instance of the Strimzi-UI server
29
-
When I make a 'get' request to '<Asset>'
30
-
Then I get the expected status code '<StatusCode>' response
31
-
# if the route (not file) is not matched, we redirect to index.html. Hence / and someroute response
32
-
Examples:
33
-
| Asset | StatusCode |
34
-
| /index.html | 200 |
35
-
| /images/picture.svg | 200 |
36
-
| /doesnotexist.html | 404 |
37
-
| /someroute | 302 |
38
-
| /protected.html | 511 |
39
-
| / | 200 |
36
+
Scenario Outline: With auth '<Auth>' - if assets can be served, the client module returns the appropriate <StatusCode> return code for a request of <Asset>
37
+
Given a 'client_only' server configuration
38
+
And There are files to serve
39
+
And '<Auth>' authentication is required
40
+
And I run an instance of the Strimzi-UI server
41
+
When I make a 'get' request to '<Asset>'
42
+
Then I get the expected status code '<StatusCode>' response
43
+
# if the route (not file) is not matched, we render index.html as the repsonse (200)
44
+
Examples:
45
+
| Asset | Auth | StatusCode |
46
+
| /index.html | scram | 511 |
47
+
| /images/picture.svg | scram | 200 |
48
+
| /doesnotexist.html | scram | 511 |
49
+
| /someroute | scram | 511 |
50
+
| /protected.html | scram | 511 |
51
+
| / | scram | 511 |
52
+
| /index.html | oauth | 511 |
53
+
| /images/picture.svg | oauth | 200 |
54
+
| /doesnotexist.html | oauth | 511 |
55
+
| /someroute | oauth | 511 |
56
+
| /protected.html | oauth | 511 |
57
+
| / | oauth | 511 |
58
+
| /index.html | none | 200 |
59
+
| /images/picture.svg | none | 200 |
60
+
| /doesnotexist.html | none | 200 |
61
+
| /someroute | none | 200 |
62
+
| /protected.html | none | 200 |
63
+
| / | none | 200 |
40
64
41
65
42
-
Scenario: Critical configuration is templated into index.html so the client can bootstrap
43
-
Given a 'client_only' server configuration
44
-
And There are files to serve
45
-
And Authentication is required
46
-
And I run an instance of the Strimzi-UI server
47
-
When I make a 'get' request to '/index.html'
48
-
Then the file is returned as with the expected configuration included
66
+
Scenario Outline: With auth '<Auth>' - Critical configuration is templated into index.html so the client can bootstrap
67
+
Given a 'client_only' server configuration
68
+
And There are files to serve
69
+
And '<Auth>' authentication is required
70
+
And I am authenticated
71
+
And I run an instance of the Strimzi-UI server
72
+
When I make a 'get' request to '/index.html'
73
+
Then the file is returned as with the expected configuration included
// if no match, not a file (path contains '.'), and we have an index.html file, redirect to it (ie return index so client navigation logic kicks in). Else do nothing (404 unless another module handles it)
47
-
hasIndexFile&&
48
-
routerForModule.get(/^((?!\.).)+$/,(req,res)=>
49
-
res.redirect(`/index.html`)
50
-
);
46
+
// If no match and we have an index, serve it (behind auth check)
0 commit comments