diff --git a/.travis.yml b/.travis.yml index 36fb2af1..6b024549 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,13 @@ language: android android: components: - - build-tools-29.0.2 - - android-29 + - build-tools-30.0.0 + - android-230 script: - ./gradlew check jacoco assemble - bash <(curl -s https://codecov.io/bash) +before_install: + - yes | sdkmanager "platforms;android-30" before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ diff --git a/README.md b/README.md index c6e53970..e8d767b2 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,26 @@ either through custom URI scheme redirects, or App Links. AS's that assume all clients are web-based or require clients to maintain confidentiality of the client secrets may not work well. +From Android API 30 (R) and above, set [queries](https://developer.android.com/preview/privacy/package-visibility) in the manifest, +to enable AppAuth searching for usable installed browsers. +```xml + + + + + + + + + + + + + + ... + +``` + ## Demo app A demo app is contained within this repository. For instructions on how to diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index ef6cbb5e..0a180c70 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -13,11 +13,23 @@ --> + + + + + + + + + + + + + - + + + + + + + @@ -293,12 +300,6 @@ Description: https://source.android.com/source/code-style.html --> - - - - - - diff --git a/config/coverage.gradle b/config/coverage.gradle index 2b29c48a..fb168273 100644 --- a/config/coverage.gradle +++ b/config/coverage.gradle @@ -1,8 +1,4 @@ apply plugin: 'jacoco' -jacoco { - toolVersion = "0.8.1" -} - android { testOptions { unitTests.all { @@ -22,11 +18,17 @@ task jacocoTestReport(type: JacocoReport, dependsOn: "testDebugUnitTest") { } // Class R is used, but usage will not be covered, so ignore this class from report afterEvaluate { - classDirectories = fileTree( + getClassDirectories().setFrom( + fileTree( dir: 'build/intermediates/classes/debug', excludes: ['**/BuildConfig.class'] + ) + ) + getSourceDirectories().setFrom( + files('java') + ) + getExecutionData().setFrom( + files('build/jacoco/testDebugUnitTest.exec') ) - sourceDirectories = files('java') - executionData = files('build/jacoco/testDebugUnitTest.exec') } } diff --git a/config/javadoc.gradle b/config/javadoc.gradle index d28c8292..1f4db5cd 100644 --- a/config/javadoc.gradle +++ b/config/javadoc.gradle @@ -3,7 +3,7 @@ configurations { } dependencies { - mdDoclet 'com.github.mnlipp.jdrupes-mdoclet:doclet:1.0.3' + mdDoclet 'com.github.mnlipp.jdrupes-mdoclet:doclet:1.0.10' } task androidJavadoc(type: Javadoc) { diff --git a/config/style.gradle b/config/style.gradle index c4013ef0..e73817b6 100644 --- a/config/style.gradle +++ b/config/style.gradle @@ -3,7 +3,7 @@ apply plugin: 'checkstyle' checkstyle { configFile file('../config/checkstyle/checkstyle.xml') configProperties = ['checkstyle.java.header': file('../config/checkstyle/java.header').getAbsolutePath()] - toolVersion = "8.11" + toolVersion = "8.33" } task checkAllSource(type: Checkstyle) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ee69dd68..de0ee5fe 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,4 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +#Sat Jun 13 20:20:21 CEST 2020 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip diff --git a/library/build.gradle b/library/build.gradle index e5f06cc8..5fcdac48 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -7,7 +7,7 @@ apply from: '../config/android-common.gradle' group = "net.openid" version = rootProject.versionName -android.defaultConfig.project.archivesBaseName = 'appauth' +project.archivesBaseName = 'appauth' // use a separate build type for unit tests, so that we can configure the manifest placeholder // without interfering with other builds. @@ -23,8 +23,8 @@ android.buildTypes { android.testBuildType "forTests" dependencies { - api "androidx.browser:browser:1.0.0" - implementation 'androidx.annotation:annotation:1.1.0' + api "androidx.browser:browser:${project.androidXVersions.browser}" + implementation "androidx.annotation:annotation:${project.androidXVersions.annotation}" apply from: '../config/testdeps.gradle', to:it } diff --git a/library/java/net/openid/appauth/AsciiStringListUtil.java b/library/java/net/openid/appauth/AsciiStringListUtil.java index 967c28c5..ba94778a 100644 --- a/library/java/net/openid/appauth/AsciiStringListUtil.java +++ b/library/java/net/openid/appauth/AsciiStringListUtil.java @@ -17,7 +17,6 @@ import static net.openid.appauth.Preconditions.checkArgument; import android.text.TextUtils; - import androidx.annotation.Nullable; import java.util.Arrays; diff --git a/library/java/net/openid/appauth/AuthState.java b/library/java/net/openid/appauth/AuthState.java index ae08e3d3..6ef874bb 100644 --- a/library/java/net/openid/appauth/AuthState.java +++ b/library/java/net/openid/appauth/AuthState.java @@ -24,7 +24,6 @@ import androidx.annotation.VisibleForTesting; import net.openid.appauth.internal.Logger; - import org.json.JSONException; import org.json.JSONObject; diff --git a/library/java/net/openid/appauth/AuthorizationManagementActivity.java b/library/java/net/openid/appauth/AuthorizationManagementActivity.java index a1bcd1c9..e3218f5d 100644 --- a/library/java/net/openid/appauth/AuthorizationManagementActivity.java +++ b/library/java/net/openid/appauth/AuthorizationManagementActivity.java @@ -25,7 +25,6 @@ import net.openid.appauth.AuthorizationException.AuthorizationRequestErrors; import net.openid.appauth.internal.Logger; - import org.json.JSONException; /** diff --git a/library/java/net/openid/appauth/AuthorizationRequest.java b/library/java/net/openid/appauth/AuthorizationRequest.java index 3ed5f315..ab750552 100644 --- a/library/java/net/openid/appauth/AuthorizationRequest.java +++ b/library/java/net/openid/appauth/AuthorizationRequest.java @@ -24,13 +24,11 @@ import android.net.Uri; import android.text.TextUtils; import android.util.Base64; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import net.openid.appauth.internal.UriUtil; - import org.json.JSONException; import org.json.JSONObject; diff --git a/library/java/net/openid/appauth/AuthorizationResponse.java b/library/java/net/openid/appauth/AuthorizationResponse.java index cae009cd..a231cd62 100644 --- a/library/java/net/openid/appauth/AuthorizationResponse.java +++ b/library/java/net/openid/appauth/AuthorizationResponse.java @@ -22,13 +22,11 @@ import android.content.Intent; import android.net.Uri; import android.text.TextUtils; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import net.openid.appauth.internal.UriUtil; - import org.json.JSONException; import org.json.JSONObject; diff --git a/library/java/net/openid/appauth/AuthorizationService.java b/library/java/net/openid/appauth/AuthorizationService.java index cbeeb8b6..2d5ae480 100644 --- a/library/java/net/openid/appauth/AuthorizationService.java +++ b/library/java/net/openid/appauth/AuthorizationService.java @@ -17,6 +17,7 @@ import static net.openid.appauth.Preconditions.checkNotNull; import android.annotation.TargetApi; +import android.app.Activity; import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.Context; @@ -25,7 +26,6 @@ import android.os.AsyncTask; import android.os.Build; import android.text.TextUtils; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; @@ -41,7 +41,6 @@ import net.openid.appauth.connectivity.ConnectionBuilder; import net.openid.appauth.internal.Logger; import net.openid.appauth.internal.UriUtil; - import org.json.JSONException; import org.json.JSONObject; diff --git a/library/java/net/openid/appauth/AuthorizationServiceConfiguration.java b/library/java/net/openid/appauth/AuthorizationServiceConfiguration.java index 6ad8fccb..18ebb20a 100644 --- a/library/java/net/openid/appauth/AuthorizationServiceConfiguration.java +++ b/library/java/net/openid/appauth/AuthorizationServiceConfiguration.java @@ -23,11 +23,9 @@ import androidx.annotation.Nullable; import net.openid.appauth.AuthorizationException.GeneralErrors; - import net.openid.appauth.connectivity.ConnectionBuilder; import net.openid.appauth.connectivity.DefaultConnectionBuilder; import net.openid.appauth.internal.Logger; - import org.json.JSONException; import org.json.JSONObject; diff --git a/library/java/net/openid/appauth/AuthorizationServiceDiscovery.java b/library/java/net/openid/appauth/AuthorizationServiceDiscovery.java index 8a56ff6c..4e118757 100644 --- a/library/java/net/openid/appauth/AuthorizationServiceDiscovery.java +++ b/library/java/net/openid/appauth/AuthorizationServiceDiscovery.java @@ -26,7 +26,6 @@ import net.openid.appauth.JsonUtil.StringField; import net.openid.appauth.JsonUtil.StringListField; import net.openid.appauth.JsonUtil.UriField; - import org.json.JSONException; import org.json.JSONObject; diff --git a/library/java/net/openid/appauth/ClientSecretBasic.java b/library/java/net/openid/appauth/ClientSecretBasic.java index debc0320..8fb52678 100644 --- a/library/java/net/openid/appauth/ClientSecretBasic.java +++ b/library/java/net/openid/appauth/ClientSecretBasic.java @@ -17,7 +17,6 @@ import static net.openid.appauth.Preconditions.checkNotNull; import android.util.Base64; - import androidx.annotation.NonNull; import net.openid.appauth.internal.UriUtil; diff --git a/library/java/net/openid/appauth/IdToken.java b/library/java/net/openid/appauth/IdToken.java index 101632b9..302bcc3c 100644 --- a/library/java/net/openid/appauth/IdToken.java +++ b/library/java/net/openid/appauth/IdToken.java @@ -17,12 +17,10 @@ import android.net.Uri; import android.text.TextUtils; import android.util.Base64; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import net.openid.appauth.AuthorizationException.GeneralErrors; - import org.json.JSONException; import org.json.JSONObject; diff --git a/library/java/net/openid/appauth/Preconditions.java b/library/java/net/openid/appauth/Preconditions.java index faa916f4..c86bf6b5 100644 --- a/library/java/net/openid/appauth/Preconditions.java +++ b/library/java/net/openid/appauth/Preconditions.java @@ -15,7 +15,6 @@ package net.openid.appauth; import android.text.TextUtils; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; diff --git a/library/java/net/openid/appauth/TokenRequest.java b/library/java/net/openid/appauth/TokenRequest.java index 18e62e2c..b1c87669 100644 --- a/library/java/net/openid/appauth/TokenRequest.java +++ b/library/java/net/openid/appauth/TokenRequest.java @@ -21,7 +21,6 @@ import android.net.Uri; import android.text.TextUtils; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; diff --git a/library/java/net/openid/appauth/TokenResponse.java b/library/java/net/openid/appauth/TokenResponse.java index c00ba97d..91cbf48c 100644 --- a/library/java/net/openid/appauth/TokenResponse.java +++ b/library/java/net/openid/appauth/TokenResponse.java @@ -21,7 +21,6 @@ import static net.openid.appauth.Preconditions.checkNullOrNotEmpty; import android.text.TextUtils; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; diff --git a/library/java/net/openid/appauth/browser/BrowserDescriptor.java b/library/java/net/openid/appauth/browser/BrowserDescriptor.java index 6ca76697..d9f85f5a 100644 --- a/library/java/net/openid/appauth/browser/BrowserDescriptor.java +++ b/library/java/net/openid/appauth/browser/BrowserDescriptor.java @@ -17,7 +17,6 @@ import android.content.pm.PackageInfo; import android.content.pm.Signature; import android.util.Base64; - import androidx.annotation.NonNull; import java.security.MessageDigest; diff --git a/library/java/net/openid/appauth/browser/BrowserSelector.java b/library/java/net/openid/appauth/browser/BrowserSelector.java index b3f3881b..75da1ca5 100644 --- a/library/java/net/openid/appauth/browser/BrowserSelector.java +++ b/library/java/net/openid/appauth/browser/BrowserSelector.java @@ -182,7 +182,8 @@ private static boolean hasWarmupService(PackageManager pm, String packageName) { private static boolean isFullBrowser(ResolveInfo resolveInfo) { // The filter must match ACTION_VIEW, CATEGORY_BROWSEABLE, and at least one scheme, if (!resolveInfo.filter.hasAction(Intent.ACTION_VIEW) - || !resolveInfo.filter.hasCategory(Intent.CATEGORY_BROWSABLE) + || !(resolveInfo.filter.hasCategory(Intent.CATEGORY_BROWSABLE) + || (resolveInfo.filter.hasCategory(Intent.CATEGORY_APP_BROWSER))) || resolveInfo.filter.schemesIterator() == null) { return false; } diff --git a/library/java/net/openid/appauth/internal/Logger.java b/library/java/net/openid/appauth/internal/Logger.java index 99068878..48e8e166 100644 --- a/library/java/net/openid/appauth/internal/Logger.java +++ b/library/java/net/openid/appauth/internal/Logger.java @@ -17,7 +17,6 @@ import static net.openid.appauth.Preconditions.checkNotNull; import android.util.Log; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; diff --git a/library/java/net/openid/appauth/internal/UriUtil.java b/library/java/net/openid/appauth/internal/UriUtil.java index fb7bf78d..72de8a96 100644 --- a/library/java/net/openid/appauth/internal/UriUtil.java +++ b/library/java/net/openid/appauth/internal/UriUtil.java @@ -17,7 +17,6 @@ import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.browser.customtabs.CustomTabsService; diff --git a/library/javatests/net/openid/appauth/TokenResponseTest.java b/library/javatests/net/openid/appauth/TokenResponseTest.java index fa6b7637..ec18c9d1 100644 --- a/library/javatests/net/openid/appauth/TokenResponseTest.java +++ b/library/javatests/net/openid/appauth/TokenResponseTest.java @@ -24,7 +24,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; -import java.util.Set; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; @@ -43,9 +42,6 @@ import static net.openid.appauth.TokenResponse.KEY_SCOPE; import static net.openid.appauth.TokenResponse.KEY_TOKEN_TYPE; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.isEmptyOrNullString; @RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk=16) diff --git a/library/javatests/net/openid/appauth/browser/BrowserSelectorTest.java b/library/javatests/net/openid/appauth/browser/BrowserSelectorTest.java index 54fc9bb9..d89a5b6d 100644 --- a/library/javatests/net/openid/appauth/browser/BrowserSelectorTest.java +++ b/library/javatests/net/openid/appauth/browser/BrowserSelectorTest.java @@ -33,6 +33,7 @@ import android.content.pm.Signature; import android.text.TextUtils; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -408,7 +409,7 @@ public TestBrowserBuilder addAuthority(String authority) { } public TestBrowserBuilder addSignature(String signature) { - mSignatures.add(signature.getBytes(Charset.forName("UTF-8"))); + mSignatures.add(signature.getBytes(StandardCharsets.UTF_8)); return this; } diff --git a/library/javatests/net/openid/appauth/browser/VersionedBrowserMatcherTest.java b/library/javatests/net/openid/appauth/browser/VersionedBrowserMatcherTest.java index de14d195..29d7441f 100644 --- a/library/javatests/net/openid/appauth/browser/VersionedBrowserMatcherTest.java +++ b/library/javatests/net/openid/appauth/browser/VersionedBrowserMatcherTest.java @@ -18,7 +18,7 @@ import java.util.Collections; import java.util.HashSet; -import junit.runner.Version; + import net.openid.appauth.BuildConfig; import org.junit.Before; import org.junit.Test; diff --git a/library/javatests/resources/mockito-extensions/org.mockito.plugins.MockMaker b/library/javatests/resources/mockito-extensions/org.mockito.plugins.MockMaker index ca6ee9ce..1f0955d4 100644 --- a/library/javatests/resources/mockito-extensions/org.mockito.plugins.MockMaker +++ b/library/javatests/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -1 +1 @@ -mock-maker-inline \ No newline at end of file +mock-maker-inline