File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
engine/src/main/java/pl/edu/icm/unity/engine/notifications/email
integration-tests/src/test/resources Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -50,19 +50,28 @@ class EmailChannel implements NotificationChannelInstance
50
50
String smtpPassword = props .getProperty (EmailFacility .CFG_PASSWD );
51
51
Authenticator smtpAuthn = (smtpUser != null && smtpPassword != null ) ?
52
52
new SimpleAuthenticator (smtpUser , smtpPassword ) : null ;
53
- String trustAll = props . getProperty ( EmailFacility . CFG_TRUST_ALL );
54
- SSLSocketFactory socketFactory = ( trustAll != null && "true" . equalsIgnoreCase ( trustAll )) ?
53
+ boolean trustAllServers = isTrustingAllServers ( props );
54
+ SSLSocketFactory socketFactory = trustAllServers ?
55
55
createTrustAllSocketFactory () : createVerifyingSocketFactory (pkiManagement );
56
56
props .put ("mail.smtp.ssl.socketFactory" , socketFactory );
57
+ if (trustAllServers )
58
+ props .put ("mail.smtp.ssl.checkserveridentity" , false );
57
59
session = Session .getInstance (props , smtpAuthn );
58
60
}
59
61
62
+ private static boolean isTrustingAllServers (Properties props )
63
+ {
64
+ String trustAll = props .getProperty (EmailFacility .CFG_TRUST_ALL );
65
+ return (trustAll != null && "true" .equalsIgnoreCase (trustAll ));
66
+ }
67
+
60
68
private SSLSocketFactory createTrustAllSocketFactory ()
61
69
{
62
70
MailSSLSocketFactory trustAllSF ;
63
71
try
64
72
{
65
73
trustAllSF = new MailSSLSocketFactory ();
74
+ //trustAllSF.setTrustManagers(new CommonX509TrustManager(new BinaryCertChainValidator(true)));
66
75
} catch (GeneralSecurityException e )
67
76
{
68
77
//really shouldn't happen
Original file line number Diff line number Diff line change 1
1
/MYmail.properties
2
2
/MYsms.properties
3
3
/MYremoteOAuth.properties
4
+ /MYmail-furms.properties
You can’t perform that action at this time.
0 commit comments