private void assertValidSSLConfig ( ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; boolean sslEnabled = ( ( ( Boolean ) props . get ( SSL_ENABLED ) ) == null ) ? false : ( Boolean ) props . get ( SSL_ENABLED ) ; boolean sslRefExists = ( ( props . get ( SSL_REF ) ) == null ) ? false : true ; if ( sslRefExists && ! sslEnabled ) { if ( trace && tc . isDebugEnabled ( ) ) { // sslRef property set in the server.xml but sslEnabled not set to true. Tr . error ( tc , "CWKKD0024.ssl.sslref.no.ssl" , MONGO , id ) ; } throw new RuntimeException ( Tr . formatMessage ( tc , "CWKKD0024.ssl.sslref.no.ssl" , MONGO , id ) ) ; } if ( sslEnabled ) { // we should have the ssl-1.0 feature selected if ( sslHelper == null ) { throw new RuntimeException ( Tr . formatMessage ( tc , "CWKKD0015.ssl.feature.missing" , MONGO , id ) ) ; } if ( useCertAuth ) { if ( ! sslEnabled ) { // SSL not enabled, so shouldn't be using certificate authentication throw new RuntimeException ( Tr . formatMessage ( tc , "CWKKD0019.ssl.certificate.no.ssl" , MONGO , id ) ) ; } if ( props . get ( USER ) != null || props . get ( PASSWORD ) != null ) { // shouldn't be using userid and pasword with certificate authentication throw new RuntimeException ( Tr . formatMessage ( tc , "CWKKD0018.ssl.user.pswd.certificate" , MONGO , id ) ) ; } } } }
Validate combination of security parameters for certificate authentication . If useCertificateAuthentication is specified SSL must be enabled an ssslRef must be specified and user and password should not be specified .