Commit 531c5ca
committed
Standardize Mocked Request Paths
Historically, Spring Security tests have set the servlet path
to indicate the path of a MockHttpServletRequest. This was needed
for AntPath and MvcRequestMatcher to correctly match the
specified request path.
This can leave MockHttpServletRequest in an inconsistent state
since requestURI is null while servletPath has a value.
For example, PathPatternRequestMatcher does not use the servlet path.
For tests to continue working both before and after the migration
from AntPath/MvcRequestMatcher to PathPatternRequestMatcher, the
mock requests should have a consistent representation of path
in getRequestURI and getServletPath.
This commit updates classes to use TestMockHttpServletRequests,
which ensures that the given path is applied to the servletPath and
requestURI, while also overriding with contextPath, servletPath,
and pathInfo when necessary.1 parent ef50ff2 commit 531c5ca
File tree
65 files changed
+553
-721
lines changed- cas
- src/test/java/org/springframework/security/cas/web
- config/src/test
- java/org/springframework/security/config
- annotation/web/configurers
- oauth2/client
- saml2
- http
- customconfigurer
- saml2
- kotlin/org/springframework/security/config/annotation/web
- etc/checkstyle
- itest/context
- src/integration-test/java/org/springframework/security/integration
- oauth2/oauth2-client
- src/test/java/org/springframework/security/oauth2/client/web
- saml2/saml2-service-provider
- src
- opensaml4Test/java/org/springframework/security/saml2/provider/service/web
- authentication
- logout
- opensaml5Test/java/org/springframework/security/saml2/provider/service/web
- authentication
- logout
- test/java/org/springframework/security/saml2/provider/service
- metadata
- web/authentication/logout
- web/src/test/java/org/springframework/security/web
- access
- channel
- expression
- intercept
- authentication
- logout
- ott
- ui
- www
- debug
- firewall
- servlet
- util/matcher
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
65 files changed
+553
-721
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
Lines changed: 13 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | | - | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | 113 | | |
115 | 114 | | |
116 | | - | |
| 115 | + | |
117 | 116 | | |
118 | | - | |
119 | 117 | | |
120 | 118 | | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
124 | | - | |
| 122 | + | |
125 | 123 | | |
126 | 124 | | |
127 | 125 | | |
| |||
133 | 131 | | |
134 | 132 | | |
135 | 133 | | |
136 | | - | |
| 134 | + | |
137 | 135 | | |
138 | | - | |
139 | 136 | | |
140 | | - | |
141 | | - | |
| 137 | + | |
142 | 138 | | |
143 | 139 | | |
144 | 140 | | |
| |||
156 | 152 | | |
157 | 153 | | |
158 | 154 | | |
159 | | - | |
| 155 | + | |
160 | 156 | | |
161 | | - | |
162 | 157 | | |
163 | 158 | | |
164 | 159 | | |
| |||
172 | 167 | | |
173 | 168 | | |
174 | 169 | | |
175 | | - | |
176 | | - | |
177 | | - | |
| 170 | + | |
178 | 171 | | |
179 | 172 | | |
180 | 173 | | |
| |||
200 | 193 | | |
201 | 194 | | |
202 | 195 | | |
203 | | - | |
| 196 | + | |
204 | 197 | | |
205 | 198 | | |
206 | | - | |
207 | 199 | | |
208 | 200 | | |
209 | 201 | | |
| |||
271 | 263 | | |
272 | 264 | | |
273 | 265 | | |
274 | | - | |
| 266 | + | |
275 | 267 | | |
276 | | - | |
277 | 268 | | |
278 | 269 | | |
279 | 270 | | |
280 | 271 | | |
281 | 272 | | |
282 | | - | |
283 | | - | |
| 273 | + | |
284 | 274 | | |
285 | 275 | | |
286 | 276 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
147 | | - | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
Lines changed: 0 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
| |||
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
113 | | - | |
114 | 112 | | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
118 | | - | |
119 | 116 | | |
120 | 117 | | |
121 | 118 | | |
| |||
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
128 | | - | |
129 | 125 | | |
130 | 126 | | |
131 | 127 | | |
132 | 128 | | |
133 | | - | |
134 | 129 | | |
135 | 130 | | |
136 | 131 | | |
| |||
140 | 135 | | |
141 | 136 | | |
142 | 137 | | |
143 | | - | |
144 | 138 | | |
145 | 139 | | |
146 | 140 | | |
147 | 141 | | |
148 | | - | |
149 | 142 | | |
150 | 143 | | |
151 | 144 | | |
| |||
Lines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
52 | | - | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
| |||
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
| 78 | + | |
| 79 | + | |
81 | 80 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 81 | + | |
85 | 82 | | |
86 | 83 | | |
87 | 84 | | |
| |||
Lines changed: 25 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | | - | |
58 | | - | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| |||
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
69 | | - | |
70 | 67 | | |
71 | 68 | | |
72 | 69 | | |
| |||
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 87 | + | |
| 88 | + | |
93 | 89 | | |
94 | 90 | | |
95 | | - | |
96 | | - | |
97 | | - | |
| 91 | + | |
| 92 | + | |
98 | 93 | | |
99 | 94 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 95 | + | |
| 96 | + | |
103 | 97 | | |
104 | 98 | | |
105 | 99 | | |
106 | 100 | | |
107 | 101 | | |
108 | 102 | | |
109 | | - | |
110 | | - | |
111 | | - | |
| 103 | + | |
| 104 | + | |
112 | 105 | | |
113 | 106 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 107 | + | |
| 108 | + | |
117 | 109 | | |
118 | 110 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 111 | + | |
| 112 | + | |
122 | 113 | | |
123 | 114 | | |
124 | 115 | | |
125 | 116 | | |
126 | 117 | | |
127 | 118 | | |
128 | | - | |
129 | | - | |
| 119 | + | |
| 120 | + | |
130 | 121 | | |
131 | 122 | | |
132 | | - | |
133 | | - | |
| 123 | + | |
| 124 | + | |
134 | 125 | | |
135 | 126 | | |
136 | | - | |
137 | | - | |
| 127 | + | |
| 128 | + | |
138 | 129 | | |
139 | 130 | | |
140 | 131 | | |
141 | 132 | | |
142 | 133 | | |
143 | 134 | | |
144 | | - | |
145 | | - | |
| 135 | + | |
| 136 | + | |
146 | 137 | | |
147 | 138 | | |
148 | | - | |
149 | | - | |
| 139 | + | |
| 140 | + | |
150 | 141 | | |
151 | 142 | | |
152 | | - | |
153 | | - | |
| 143 | + | |
| 144 | + | |
154 | 145 | | |
155 | 146 | | |
156 | 147 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
0 commit comments