diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 225c16b9..034bee8b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -13,3 +13,4 @@ Alex Chau Benjamin Franz Rebecka Gulliksson Rahul Ravikumar +Henning Nielsen Lund diff --git a/library/java/net/openid/appauth/browser/Browsers.java b/library/java/net/openid/appauth/browser/Browsers.java index bcf28d61..e0475a32 100644 --- a/library/java/net/openid/appauth/browser/Browsers.java +++ b/library/java/net/openid/appauth/browser/Browsers.java @@ -135,6 +135,12 @@ public static final class SBrowser { public static final Set SIGNATURE_SET = Collections.singleton(SIGNATURE_HASH); + /** + * The version in which Custom Tabs were introduced in Samsung Internet. + */ + public static final DelimitedVersion MINIMUM_VERSION_FOR_CUSTOM_TAB = + DelimitedVersion.parse("4.0"); + /** * Creates a browser descriptor for the specified version of SBrowser, when * used as a standalone browser. diff --git a/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java b/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java index 85deeaed..0866d4b4 100644 --- a/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java +++ b/library/java/net/openid/appauth/browser/VersionedBrowserMatcher.java @@ -68,7 +68,7 @@ public class VersionedBrowserMatcher implements BrowserMatcher { Browsers.SBrowser.PACKAGE_NAME, Browsers.SBrowser.SIGNATURE_SET, true, - VersionRange.ANY_VERSION); + VersionRange.atLeast(Browsers.SBrowser.MINIMUM_VERSION_FOR_CUSTOM_TAB)); private String mPackageName; private Set mSignatureHashes; diff --git a/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java b/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java index b388eeeb..dd982ccd 100644 --- a/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java +++ b/library/javatests/net/openid/appauth/browser/AnyBrowserMatcherTest.java @@ -34,5 +34,7 @@ public void testMatches() { .isTrue(); assertThat(AnyBrowserMatcher.INSTANCE.matches(Browsers.SBrowser.standaloneBrowser("2.1"))) .isTrue(); + assertThat(AnyBrowserMatcher.INSTANCE.matches(Browsers.SBrowser.customTab("4.0"))) + .isTrue(); } } diff --git a/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java b/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java index b95a0d6a..a970a3b1 100644 --- a/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java +++ b/library/javatests/net/openid/appauth/browser/BrowserWhitelistTest.java @@ -62,7 +62,8 @@ public void testMatches_firefoxOrSamsung() { assertThat(whitelist.matches(Browsers.Chrome.customTab("46"))).isFalse(); assertThat(whitelist.matches(Browsers.Firefox.standaloneBrowser("10"))).isTrue(); assertThat(whitelist.matches(Browsers.SBrowser.standaloneBrowser("10"))).isTrue(); - assertThat(whitelist.matches(Browsers.SBrowser.customTab("10"))).isTrue(); + assertThat(whitelist.matches(Browsers.SBrowser.customTab("4.0"))).isTrue(); + assertThat(whitelist.matches(Browsers.SBrowser.customTab("3.9"))).isFalse(); } }