File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
main/java/org/neo4j/driver/internal
test/java/org/neo4j/driver/internal Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -92,11 +92,11 @@ private SecurityPlan createSecurityPlanFromScheme( String scheme ) throws Genera
92
92
{
93
93
if ( isHighTrustScheme (scheme ) )
94
94
{
95
- return SecurityPlanImpl .forSystemCASignedCertificates ( trustStrategy . isHostnameVerificationEnabled () );
95
+ return SecurityPlanImpl .forSystemCASignedCertificates ( true );
96
96
}
97
97
else
98
98
{
99
- return SecurityPlanImpl .forAllCertificates ( trustStrategy . isHostnameVerificationEnabled () );
99
+ return SecurityPlanImpl .forAllCertificates ( false );
100
100
}
101
101
}
102
102
Original file line number Diff line number Diff line change @@ -75,9 +75,22 @@ void testSystemCertCompatibleConfiguration( String scheme ) throws Exception
75
75
SSLContext defaultContext = SSLContext .getDefault ();
76
76
77
77
assertTrue ( securityPlan .requiresEncryption () );
78
+ assertTrue ( securityPlan .requiresHostnameVerification () );
78
79
assertEquals ( defaultContext , securityPlan .sslContext () );
79
80
}
80
81
82
+ @ ParameterizedTest
83
+ @ MethodSource ( "selfSignedSchemes" )
84
+ void testSelfSignedCertConfigDisablesHostnameVerification ( String scheme ) throws Exception
85
+ {
86
+ SecuritySettings securitySettings = new SecuritySettings .SecuritySettingsBuilder ().build ();
87
+
88
+ SecurityPlan securityPlan = securitySettings .createSecurityPlan ( scheme );
89
+
90
+ assertTrue ( securityPlan .requiresEncryption () );
91
+ assertFalse ( securityPlan .requiresHostnameVerification () );
92
+ }
93
+
81
94
@ ParameterizedTest
82
95
@ MethodSource ( "allSchemes" )
83
96
void testThrowsOnUserCustomizedEncryption ( String scheme )
@@ -156,7 +169,7 @@ void testConfiguredEncryption()
156
169
}
157
170
158
171
@ Test
159
- void testConfiguredAllCertificates () throws NoSuchAlgorithmException
172
+ void testConfiguredAllCertificates ()
160
173
{
161
174
SecuritySettings securitySettings = new SecuritySettings .SecuritySettingsBuilder ()
162
175
.withEncryption ()
You can’t perform that action at this time.
0 commit comments