Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
language: android
android:
components:
- build-tools-29.0.2
- android-29
- build-tools-30.0.0
- android-230

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a typo? Should it be android-30?

script:
- ./gradlew check jacoco assemble
- bash <(curl -s https://codecov.io/bash)
before_install:
- yes | sdkmanager "platforms;android-30"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming the above android-230 is a typo, this might not be needed anymore?

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<manifest package="com.example.game">
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.APP_BROWSER" />
<data android:scheme="https" />
</intent>
</queries>
...
</manifest>
```

## Demo app

A demo app is contained within this repository. For instructions on how to
Expand Down
14 changes: 13 additions & 1 deletion app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,23 @@
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="net.openid.appauthdemo" >

<uses-permission android:name="android.permission.INTERNET" />

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.APP_BROWSER" />
<data android:scheme="https" />
</intent>
</queries>

<application
android:allowBackup="false"
android:fullBackupContent="false"
Expand Down
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ android {

dependencies {
implementation project(':library')
implementation "androidx.appcompat:appcompat:1.1.0"
implementation 'androidx.annotation:annotation:1.1.0'
implementation "com.google.android.material:material:1.0.0"
implementation "com.github.bumptech.glide:glide:4.10.0"
implementation 'com.squareup.okio:okio:1.14.1'
implementation 'joda-time:joda-time:2.10'

annotationProcessor "com.github.bumptech.glide:compiler:4.10.0"
implementation "androidx.appcompat:appcompat:${project.androidXVersions.appcompat}"
implementation "androidx.annotation:annotation:${project.androidXVersions.annotation}"
implementation "com.google.android.material:material:${project.googleVersions.material}"
implementation "com.github.bumptech.glide:glide:${project.googleVersions.glide}"
implementation "com.squareup.okio:okio:${project.okioVersion}"
implementation "joda-time:joda-time:${project.jodaVersion}"

annotationProcessor "com.github.bumptech.glide:compiler:${project.googleVersions.glide}"
}

apply from: '../config/style.gradle'
2 changes: 0 additions & 2 deletions app/java/net/openid/appauthdemo/AuthStateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand All @@ -27,7 +26,6 @@
import net.openid.appauth.AuthorizationResponse;
import net.openid.appauth.RegistrationResponse;
import net.openid.appauth.TokenResponse;

import org.json.JSONException;

import java.lang.ref.WeakReference;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import net.openid.appauth.browser.BrowserDescriptor;
Expand Down
3 changes: 0 additions & 3 deletions app/java/net/openid/appauthdemo/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@
import android.content.res.Resources;
import android.net.Uri;
import android.text.TextUtils;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import net.openid.appauth.connectivity.ConnectionBuilder;
import net.openid.appauth.connectivity.DefaultConnectionBuilder;

import okio.Buffer;
import okio.BufferedSource;
import okio.Okio;

import org.json.JSONException;
import org.json.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import android.annotation.SuppressLint;
import android.net.Uri;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

Expand All @@ -31,7 +30,6 @@
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.concurrent.TimeUnit;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
Expand Down
2 changes: 0 additions & 2 deletions app/java/net/openid/appauthdemo/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;

import androidx.annotation.AnyThread;
import androidx.annotation.ColorRes;
import androidx.annotation.MainThread;
Expand All @@ -41,7 +40,6 @@
import androidx.annotation.WorkerThread;
import androidx.appcompat.app.AppCompatActivity;
import androidx.browser.customtabs.CustomTabsIntent;

import com.google.android.material.snackbar.Snackbar;

import net.openid.appauth.AppAuthConfiguration;
Expand Down
4 changes: 0 additions & 4 deletions app/java/net/openid/appauthdemo/TokenActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.MainThread;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import androidx.appcompat.app.AppCompatActivity;

import com.google.android.material.snackbar.Snackbar;

import net.openid.appauth.AppAuthConfiguration;
Expand All @@ -40,9 +38,7 @@
import net.openid.appauth.ClientAuthentication;
import net.openid.appauth.TokenRequest;
import net.openid.appauth.TokenResponse;

import okio.Okio;

import org.joda.time.format.DateTimeFormat;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down
33 changes: 26 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.ajoberstar.grgit.Grgit

apply from: 'config/keystore.gradle'

buildscript {
Expand All @@ -6,10 +8,11 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
classpath 'org.ajoberstar:gradle-git:1.7.2'
classpath "org.jacoco:org.jacoco.core:0.8.5"
}
}

Expand All @@ -24,7 +27,7 @@ subprojects {
ext.verifyKeystore()

try {
def grgit = org.ajoberstar.grgit.Grgit.open(dir: '.')
def grgit = Grgit.open(dir: '.')
def lastCommit = grgit.head()

project.ext.versionNum = grgit.log(includes:['HEAD']).size()
Expand All @@ -33,15 +36,31 @@ try {
if (project.ext.versionName == null) {
project.ext.versionName = 'DEV'
}
} catch (Exception ex) {
} catch (Exception ignored) {
project.ext.versionNum = 0
project.ext.versionName = 'DEV'
project.ext.versionDate = new Date()
}

project.ext.minSdkVersion = 16
project.ext.compileSdkVersion = 29
project.ext.buildToolsVersion = '29.0.2'
project.ext {
minSdkVersion = 16
compileSdkVersion = 30
buildToolsVersion = '30.0.0'

googleVersions = [
glide : '4.11.0',
material : '1.1.0',
]

androidXVersions = [
annotation : '1.1.0',
appCompat : '1.1.0',
browser : '1.2.0',
]

okioVersion = '1.17.5'
jodaVersion = '2.10.6'
}

task showVersion {
doLast {
Expand Down
4 changes: 2 additions & 2 deletions config/android-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
main.res.srcDir 'res'
main.assets.srcDir 'assets'
main.resources.srcDir 'java'
test.setRoot('javatests');
test.java.srcDir('javatests');
test.setRoot('javatests')
test.java.srcDir('javatests')
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
15 changes: 8 additions & 7 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.org/dtds/configuration_1_3.dtd">

<!--
Checkstyle-Configuration: Android Style
Expand All @@ -14,6 +14,13 @@ Description: https://source.android.com/source/code-style.html
<!-- Default severity is error -->
<property name="severity" value="warning"/>

<!-- 100 char per line max, unless unavoidable -->
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern"
value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>

<module name="TreeWalker">

<!--#################################################################-->
Expand Down Expand Up @@ -293,12 +300,6 @@ Description: https://source.android.com/source/code-style.html
-->
<module name="CommentsIndentation"/>

<!-- 100 char per line max, unless unavoidable -->
<module name="LineLength">
<property name="max" value="100"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>

<!--#################################################################-->
<!--################ MISC. LANGUAGE CHECKS ##########################-->
<!--#################################################################-->
Expand Down
16 changes: 9 additions & 7 deletions config/coverage.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.1"
}

android {
testOptions {
unitTests.all {
Expand 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')
}
}
2 changes: 1 addition & 1 deletion config/javadoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion config/style.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}

Expand Down
1 change: 0 additions & 1 deletion library/java/net/openid/appauth/AsciiStringListUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import static net.openid.appauth.Preconditions.checkArgument;

import android.text.TextUtils;

import androidx.annotation.Nullable;

import java.util.Arrays;
Expand Down
1 change: 0 additions & 1 deletion library/java/net/openid/appauth/AuthState.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import androidx.annotation.VisibleForTesting;

import net.openid.appauth.internal.Logger;

import org.json.JSONException;
import org.json.JSONObject;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import net.openid.appauth.AuthorizationException.AuthorizationRequestErrors;
import net.openid.appauth.internal.Logger;

import org.json.JSONException;

/**
Expand Down
Loading