Skip to content

Commit 06379ce

Browse files
committed
Restore binary compatibility with 0.3.7
1 parent b45bb27 commit 06379ce

File tree

8 files changed

+188
-42
lines changed

8 files changed

+188
-42
lines changed

build.sbt

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,6 @@ lazy val sslConfigCore = project.in(file("ssl-config-core"))
4242
OsgiKeys.exportPackage := Seq(s"com.typesafe.sslconfig.*;version=${version.value}"),
4343
OsgiKeys.importPackage := Seq("!sun.misc", "!sun.security.*", configImport(), "*"),
4444
OsgiKeys.requireCapability := """osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=1.8))"""",
45-
46-
mimaBinaryIssueFilters ++= Seq(
47-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.package.foldVersion"),
48-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.package.foldRuntime"),
49-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.Ciphers.java16RecommendedCiphers"),
50-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.Ciphers.java17RecommendedCiphers"),
51-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.Base64"),
52-
53-
// Merge Lagom changes to KeyStore generation
54-
// https://github.com/lightbend/ssl-config/pull/114
55-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.FakeKeyStore.DnName"),
56-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.FakeKeyStore.createSelfSignedCertificate"),
57-
58-
// Should've always been final
59-
ProblemFilters.exclude[FinalClassProblem]("com.typesafe.sslconfig.ssl.FakeKeyStore"),
60-
61-
// Moved to FakeKeyStore-the-object
62-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.FakeKeyStore.GeneratedKeyStore"),
63-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.FakeKeyStore.SignatureAlgorithmOID"),
64-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.FakeKeyStore.SignatureAlgorithmName"),
65-
66-
// Support trustStore password
67-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.TrustStoreConfig.this"),
68-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.TrustStoreConfig.<init>$default$3"),
69-
ProblemFilters.exclude[IncompatibleResultTypeProblem]("com.typesafe.sslconfig.ssl.TrustStoreConfig.<init>$default$4"),
70-
71-
// DefaultHostnameVerifier was decomissioned
72-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.DefaultHostnameVerifier"),
73-
74-
// Remove evil monkeypatching debug classes
75-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.MonkeyPatcher"),
76-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.debug.FixInternalDebugLogging"),
77-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.debug.FixInternalDebugLogging$MonkeyPatchInternalSslDebugAction"),
78-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.debug.FixLoggingAction"),
79-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.debug.ClassFinder"),
80-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.debug.FixCertpathDebugLogging$MonkeyPatchSunSecurityUtilDebugAction"),
81-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.debug.FixCertpathDebugLogging"),
82-
ProblemFilters.exclude[MissingClassProblem]("com.typesafe.sslconfig.ssl.debug.FixCertpathDebugLogging$SunSecurityUtilDebugLogger"),
83-
84-
// Warn on deprecated settings, using LoggerFactory.
85-
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sslconfig.ssl.SSLConfigParser.this")
86-
)
8745
).enablePlugins(SbtOsgi)
8846

8947
lazy val documentation = project.in(file("documentation"))

ssl-config-core/src/main/scala/com/typesafe/sslconfig/ssl/Config.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ object SSLConfigFactory {
544544

545545
class SSLConfigParser(c: EnrichedConfig, classLoader: ClassLoader, loggerFactory: Option[LoggerFactory]) {
546546

547+
def this(c: EnrichedConfig, classLoader: ClassLoader) = this(c, classLoader, None)
548+
547549
def parse(): SSLConfigSettings = {
548550

549551
val default = c.get[Boolean]("default")
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (C) 2015 - 2019 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
package com.typesafe.sslconfig.ssl
6+
7+
import java.security.Principal
8+
import java.security.cert.{ Certificate, CertificateException, X509Certificate }
9+
10+
import com.typesafe.sslconfig.util.LoggerFactory
11+
import javax.net.ssl.{ HostnameVerifier, SSLPeerUnverifiedException, SSLSession }
12+
import javax.security.auth.kerberos.KerberosPrincipal
13+
import sun.security.util.HostnameChecker
14+
15+
@deprecated("DefaultHostnameVerifier has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
16+
class DefaultHostnameVerifier(mkLogger: LoggerFactory) extends HostnameVerifier {
17+
private val logger = mkLogger(getClass)
18+
19+
def hostnameChecker: HostnameChecker = {
20+
logger.warn("DefaultHostnameVerifier has been deprecated and does nothing. Please use the javax.net.debug system property.")
21+
HostnameChecker.getInstance(HostnameChecker.TYPE_TLS)
22+
}
23+
24+
def matchKerberos(hostname: String, principal: Principal) = {
25+
logger.warn("DefaultHostnameVerifier has been deprecated and does nothing. Please use the javax.net.debug system property.")
26+
true
27+
}
28+
29+
def isKerberos(principal: Principal): Boolean = {
30+
logger.warn("DefaultHostnameVerifier has been deprecated and does nothing. Please use the javax.net.debug system property.")
31+
true
32+
}
33+
34+
def verify(hostname: String, session: SSLSession): Boolean = {
35+
logger.warn("DefaultHostnameVerifier has been deprecated and does nothing. Please use the javax.net.debug system property.")
36+
true
37+
}
38+
39+
/** INTERNAL API */
40+
def matchCertificates(hostname: String, peerCertificates: Array[Certificate]): Boolean = {
41+
logger.warn("DefaultHostnameVerifier has been deprecated and does nothing. Please use the javax.net.debug system property.")
42+
true
43+
}
44+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright (C) 2015 - 2019 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
package com.typesafe.sslconfig.ssl
6+
7+
import java.lang.reflect.Field
8+
9+
@deprecated("MonkeyPatcher has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
10+
trait MonkeyPatcher {
11+
def monkeyPatchField(field: Field, newObject: AnyRef): Unit = ()
12+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (C) 2015 - 2019 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
package com.typesafe.sslconfig.ssl.debug
6+
7+
import com.typesafe.sslconfig.util.NoDepsLogger
8+
9+
@deprecated("ClassFinder has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
10+
trait ClassFinder {
11+
def logger: NoDepsLogger
12+
def initialResource: String
13+
def isValidClass(className: String): Boolean
14+
def findClasses: Set[Class[_]] = Set.empty
15+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (C) 2015 - 2019 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
package com.typesafe.sslconfig.ssl.debug
6+
7+
import java.security.AccessController
8+
import com.typesafe.sslconfig.util.{ LoggerFactory, NoDepsLogger }
9+
10+
import scala.util.control.NonFatal
11+
import sun.security.util.Debug
12+
13+
@deprecated("FixCertpathDebugLogging has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
14+
class FixCertpathDebugLogging(mkLogger: LoggerFactory) {
15+
val logger = mkLogger("com.typesafe.sslconfig.ssl.debug.FixCertpathDebugLogging")
16+
17+
@deprecated("MonkeyPatchSunSecurityUtilDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
18+
class MonkeyPatchSunSecurityUtilDebugAction(val newDebug: Debug, val newOptions: String) extends FixLoggingAction {
19+
val logger = mkLogger("com.typesafe.sslconfig.ssl.debug.FixCertpathDebugLogging.MonkeyPatchSunSecurityUtilDebugAction")
20+
21+
val initialResource = "/sun/security/provider/certpath/Builder.class"
22+
23+
val debugType = classOf[Debug]
24+
25+
def isValidClass(className: String): Boolean = {
26+
logger.warn("MonkeyPatchSunSecurityUtilDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.")
27+
if (className.startsWith("java.security.cert")) return true
28+
if (className.startsWith("sun.security.provider.certpath")) return true
29+
if (className.equals("sun.security.x509.InhibitAnyPolicyExtension")) return true
30+
false
31+
}
32+
33+
def isUsingDebug: Boolean = {
34+
logger.warn("MonkeyPatchSunSecurityUtilDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.")
35+
(newOptions != null) && newOptions.contains("certpath")
36+
}
37+
38+
def run(): Unit = {
39+
logger.warn("MonkeyPatchSunSecurityUtilDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.")
40+
}
41+
}
42+
43+
@deprecated("SunSecurityUtilDebugLogger has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
44+
class SunSecurityUtilDebugLogger(logger: NoDepsLogger) extends sun.security.util.Debug {
45+
override def println(message: String): Unit = ()
46+
override def println(): Unit = ()
47+
}
48+
49+
def apply(newOptions: String, debugOption: Option[Debug] = None): Unit = {
50+
logger.warn("FixCertpathDebugLogging has been deprecated and does nothing. Please use the javax.net.debug system property.")
51+
}
52+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (C) 2015 - 2019 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
package com.typesafe.sslconfig.ssl.debug
6+
7+
import com.typesafe.sslconfig.util.LoggerFactory
8+
9+
@deprecated("FixInternalDebugLogging has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
10+
class FixInternalDebugLogging(mkLogger: LoggerFactory) {
11+
private val logger = mkLogger("com.typesafe.sslconfig.ssl.debug.FixInternalDebugLogging")
12+
13+
@deprecated("MonkeyPatchInternalSslDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
14+
class MonkeyPatchInternalSslDebugAction(val newOptions: String) extends FixLoggingAction {
15+
override val logger = mkLogger("com.typesafe.sslconfig.ssl.debug.FixInternalDebugLogging.MonkeyPatchInternalSslDebugAction")
16+
17+
val initialResource = "/sun/security/ssl/Debug.class"
18+
val debugClassName = "sun.security.ssl.Debug"
19+
20+
def isValidClass(className: String): Boolean = {
21+
logger.warn("MonkeyPatchInternalSslDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.")
22+
if (className.startsWith("com.sun.net.ssl.internal.ssl")) return true
23+
if (className.startsWith("sun.security.ssl")) return true
24+
false
25+
}
26+
27+
def isUsingDebug: Boolean = {
28+
logger.warn("MonkeyPatchInternalSslDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.")
29+
(newOptions != null) && (!newOptions.isEmpty)
30+
}
31+
32+
def run(): Unit = {
33+
logger.warn("MonkeyPatchInternalSslDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.")
34+
}
35+
36+
def apply(newOptions: String): Unit = {
37+
logger.warn("MonkeyPatchInternalSslDebugAction has been deprecated and does nothing. Please use the javax.net.debug system property.")
38+
}
39+
}
40+
41+
def apply(newOptions: String): Unit = {
42+
logger.warn("FixInternalDebugLogging has been deprecated and does nothing. Please use the javax.net.debug system property.")
43+
}
44+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (C) 2015 - 2019 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
package com.typesafe.sslconfig.ssl.debug
6+
7+
import java.lang.reflect.Field
8+
import java.security.PrivilegedExceptionAction
9+
import com.typesafe.sslconfig.ssl.MonkeyPatcher
10+
11+
@deprecated("FixLoggingAction has been deprecated and does nothing. Please use the javax.net.debug system property.", "0.4.0")
12+
abstract class FixLoggingAction extends PrivilegedExceptionAction[Unit] with MonkeyPatcher with ClassFinder {
13+
def newOptions: String
14+
15+
def isValidField(field: Field, definedType: Class[_]): Boolean = {
16+
logger.warn("DebugConfiguration has been deprecated and does nothing. Please use the javax.net.debug system property.")
17+
false
18+
}
19+
}

0 commit comments

Comments
 (0)