File tree Expand file tree Collapse file tree 7 files changed +26
-21
lines changed Expand file tree Collapse file tree 7 files changed +26
-21
lines changed Original file line number Diff line number Diff line change @@ -93,15 +93,15 @@ public void writeHeadersContentSecurityPolicyInvalid() {
93
93
94
94
95
95
@ Test
96
- public void writeHeaderOnlyIfNotPresentContentSecurityPolicyHeader () {
96
+ public void writeContentSecurityPolicyHeaderWhenNotPresent () {
97
97
String value = new String ("value" );
98
98
this .response .setHeader (CONTENT_SECURITY_POLICY_HEADER , value );
99
99
this .writer .writeHeaders (this .request , this .response );
100
100
assertThat (this .response .getHeader (CONTENT_SECURITY_POLICY_HEADER )).isSameAs (value );
101
101
}
102
102
103
103
@ Test
104
- public void writeHeaderOnlyIfNotPresentContentSecurityPolicyReportOnlyHeader () {
104
+ public void writeContentSecurityPolicyReportOnlyHeaderWhenNotPresent () {
105
105
String value = new String ("value" );
106
106
this .response .setHeader (CONTENT_SECURITY_POLICY_REPORT_ONLY_HEADER , value );
107
107
this .writer .setReportOnly (true );
Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .springframework .security .web .header .writers ;
17
17
18
- import static org .assertj .core .api .Assertions .assertThat ;
19
-
20
18
import java .net .URI ;
21
19
import java .net .URISyntaxException ;
22
20
import java .util .Collections ;
25
23
26
24
import org .junit .Before ;
27
25
import org .junit .Test ;
26
+
28
27
import org .springframework .mock .web .MockHttpServletRequest ;
29
28
import org .springframework .mock .web .MockHttpServletResponse ;
30
29
30
+ import static org .assertj .core .api .Assertions .assertThat ;
31
+
31
32
/**
32
33
* @author Tim Ysewyn
33
34
* @author Ankur Pathak
@@ -203,7 +204,7 @@ public void setIncorrectReportUri() {
203
204
}
204
205
205
206
@ Test
206
- public void writeHeaderOnlyIfNotPresentPublicKeyPins () {
207
+ public void writePublicKeyPinsHeaderOnlyWhenNotPresent () {
207
208
String value = new String ("value" );
208
209
this .response .setHeader (HPKP_HEADER_NAME , value );
209
210
this .writer .setReportOnly (false );
@@ -212,7 +213,7 @@ public void writeHeaderOnlyIfNotPresentPublicKeyPins(){
212
213
}
213
214
214
215
@ Test
215
- public void writeHeaderOnlyIfNotPresentPublicKeyPinsReportOnly () {
216
+ public void writePublicKeyPinsReportOnlyHeaderWhenNotPresent () {
216
217
String value = new String ("value" );
217
218
this .response .setHeader (HPKP_RO_HEADER_NAME , value );
218
219
this .writer .setReportOnly (false );
Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .springframework .security .web .header .writers ;
17
17
18
- import static org .assertj .core .api .Assertions .assertThat ;
19
-
20
18
import org .junit .Before ;
21
19
import org .junit .Test ;
20
+
22
21
import org .springframework .mock .web .MockHttpServletRequest ;
23
22
import org .springframework .mock .web .MockHttpServletResponse ;
24
23
import org .springframework .security .web .util .matcher .AnyRequestMatcher ;
25
24
25
+ import static org .assertj .core .api .Assertions .assertThat ;
26
+
26
27
/**
27
28
* @author Rob Winch
28
29
* @author Ankur Pathak
@@ -154,7 +155,7 @@ public void setRequestMatcherToNull() {
154
155
}
155
156
156
157
@ Test
157
- public void writeHeaderOnlyIfNotPresent () {
158
+ public void writeHeaderWhenNotPresent () {
158
159
String value = new String ("value" );
159
160
this .response .setHeader (HSTS_HEADER_NAME , value );
160
161
this .writer .writeHeaders (this .request , this .response );
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ public void writeHeaderReferrerPolicyInvalid() {
69
69
}
70
70
71
71
@ Test
72
- public void writeHeaderOnlyIfNotPresent () {
72
+ public void writeHeaderWhenNotPresent () {
73
73
String value = new String ("value" );
74
74
this .response .setHeader (REFERRER_POLICY_HEADER , value );
75
75
this .writer .writeHeaders (this .request , this .response );
Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .springframework .security .web .header .writers ;
17
17
18
- import static org .assertj .core .api .Assertions .assertThat ;
19
-
20
18
import java .util .Arrays ;
21
19
import java .util .Collections ;
22
20
23
21
import org .junit .Before ;
24
22
import org .junit .Test ;
23
+
25
24
import org .springframework .mock .web .MockHttpServletRequest ;
26
25
import org .springframework .mock .web .MockHttpServletResponse ;
27
26
import org .springframework .security .web .header .Header ;
28
27
28
+ import static org .assertj .core .api .Assertions .assertThat ;
29
+
29
30
/**
30
31
* Test for the {@code StaticHeadersWriter}
31
32
*
@@ -98,7 +99,7 @@ public void writeHeadersMulti() {
98
99
}
99
100
100
101
@ Test
101
- public void writeHeaderOnlyIfNotPresent () {
102
+ public void writeHeaderWhenNotPresent () {
102
103
String pragmaValue = new String ("pragmaValue" );
103
104
String cacheControlValue = new String ("cacheControlValue" );
104
105
this .response .setHeader ("Pragma" , pragmaValue );
Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .springframework .security .web .header .writers ;
17
17
18
- import static org .assertj .core .api .Assertions .assertThat ;
19
-
20
18
import org .junit .Before ;
21
19
import org .junit .Test ;
20
+
22
21
import org .springframework .mock .web .MockHttpServletRequest ;
23
22
import org .springframework .mock .web .MockHttpServletResponse ;
24
23
24
+ import static org .assertj .core .api .Assertions .assertThat ;
25
+
25
26
/**
26
27
* @author Rob Winch
27
28
* @author Ankur Pathak
@@ -92,7 +93,7 @@ public void setBlockTrueWithEnabledFalse() {
92
93
}
93
94
94
95
@ Test
95
- public void writeHeaderOnlyIfNotPresent () {
96
+ public void writeHeaderWhenNotPresent () {
96
97
String value = new String ("value" );
97
98
this .response .setHeader (XSS_PROTECTION_HEADER , value );
98
99
this .writer .writeHeaders (this .request , this .response );
Original file line number Diff line number Diff line change 16
16
17
17
package org .springframework .security .web .header .writers .frameoptions ;
18
18
19
+ import java .util .Arrays ;
20
+ import java .util .Collections ;
21
+
19
22
import org .junit .Test ;
23
+
20
24
import org .springframework .mock .web .MockHttpServletRequest ;
21
25
import org .springframework .mock .web .MockHttpServletResponse ;
22
26
23
- import java .util .Arrays ;
24
- import java .util .Collections ;
25
-
26
27
import static org .assertj .core .api .Assertions .assertThat ;
27
28
28
29
/**
29
30
* @author Rob Winch
30
- * @author AnkurPathak
31
+ * @author Ankur Pathak
31
32
* @since 5.0
32
33
*/
33
34
public class XFrameOptionsHeaderWriterTests {
@@ -48,7 +49,7 @@ public void writeHeadersWhenWhiteList() {
48
49
}
49
50
50
51
@ Test
51
- public void writeHeaderOnlyIfNotPresent () {
52
+ public void writeHeaderWhenNotPresent () {
52
53
WhiteListedAllowFromStrategy whitelist = new WhiteListedAllowFromStrategy (Collections .singletonList ("example.com" ));
53
54
XFrameOptionsHeaderWriter writer = new XFrameOptionsHeaderWriter (whitelist );
54
55
String value = new String ("value" );
You can’t perform that action at this time.
0 commit comments