Skip to content

Commit 1abc93c

Browse files
nisrulzMardaneus86thestr4ng3rLuca Figolitaikonavt
authored
Update: SDK to support Jitpack (#7)
* upgrade gradle wrapper to v8.6 * add jitpack config * updated versions and cleanup build.gradle * Idtoken time skew (#3) * Skip issue time validation or change the allowed time skew Allows to completely disable ID tokens issue time validation, or change the default of 10 minutes to a custom allowed time skew in seconds. * Update documentation to change the allowed id token time skew --------- Co-authored-by: Tim Klingeleers <[email protected]> * Fix NullPointerException for issuer without scheme in id token (#4) Uri.getScheme() may return null if no scheme is contained in the given string. This could cause a crash during id token validation when this was the case for the contained "iss" claim. Co-authored-by: Florian Märkl <[email protected]> * Add methods to request access token synchronous (#5) Co-authored-by: Luca Figoli <[email protected]> * fix configHash in app configuration (#6) Co-authored-by: Maksim <[email protected]> * fix the build * cleanup * add link to Jitpack for install details * updated agp version * upgraded gradle wrapper --------- Co-authored-by: Tim Klingeleers <[email protected]> Co-authored-by: Florian Märkl <[email protected]> Co-authored-by: Luca Figoli <[email protected]> Co-authored-by: Maksim <[email protected]>
1 parent 4df1eba commit 1abc93c

File tree

14 files changed

+672
-279
lines changed

14 files changed

+672
-279
lines changed

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![AppAuth for Android](https://rawgit.com/openid/AppAuth-Android/master/appauth_lockup.svg)
22

3-
[![Download](https://img.shields.io/maven-central/v/net.openid/appauth)](https://search.maven.org/search?q=g:net.openid%20appauth)
4-
[![Javadocs](http://javadoc.io/badge/net.openid/appauth.svg)](http://javadoc.io/doc/net.openid/appauth)
3+
[Download from Jitpack](https://www.jitpack.io/#nisrulz/AppAuth-Android/update~sdk-to-support-jitpack-SNAPSHOT)
4+
55
[![Build Status](https://github.com/openid/AppAuth-Android/actions/workflows/build.yml/badge.svg)](https://github.com/openid/AppAuth-Android/actions/workflows/build.yml)
66
[![codecov.io](https://codecov.io/github/openid/AppAuth-Android/coverage.svg?branch=master)](https://codecov.io/github/openid/AppAuth-Android?branch=master)
77

@@ -619,7 +619,7 @@ AppAuthConfiguration appAuthConfig = new AppAuthConfiguration.Builder()
619619

620620
ID Token validation was introduced in `0.8.0` but not all authorization servers or configurations support it correctly.
621621

622-
- For testing environments [setSkipIssuerHttpsCheck](https://github.com/openid/AppAuth-Android/blob/master/library/java/net/openid/appauth/AppAuthConfiguration.java#L129) can be used to bypass the fact the issuer needs to be HTTPS.
622+
- For testing environments [setSkipIssuerHttpsCheck](https://github.com/openid/AppAuth-Android/blob/master/library/java/net/openid/appauth/AppAuthConfiguration.java#L143) can be used to bypass the fact the issuer needs to be HTTPS.
623623

624624
```java
625625
AppAuthConfiguration appAuthConfig = new AppAuthConfiguration.Builder()
@@ -635,6 +635,22 @@ AuthorizationRequest authRequest = authRequestBuilder
635635
.build();
636636
```
637637

638+
- To change the default allowed time skew of 10 minutes for the issue time, [setAllowedIssueTimeSkew](https://github.com/openid/AppAuth-Android/blob/master/library/java/net/openid/appauth/AppAuthConfiguration.java#L159) can be used.
639+
640+
```java
641+
AppAuthConfiguration appAuthConfig = new AppAuthConfiguration.Builder()
642+
.setAllowedIssueTimeSkew(THIRTY_MINUTES_IN_SECONDS)
643+
.build()
644+
```
645+
646+
- For testing environments [setSkipIssueTimeValidation](https://github.com/openid/AppAuth-Android/blob/master/library/java/net/openid/appauth/AppAuthConfiguration.java#L151) can be used to bypass the issue time validation.
647+
648+
```java
649+
AppAuthConfiguration appAuthConfig = new AppAuthConfiguration.Builder()
650+
.setSkipIssueTimeValidation(true)
651+
.build()
652+
```
653+
638654
## Dynamic client registration
639655

640656
AppAuth supports the

app/java/net/openid/appauthdemo/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ private void readConfiguration() throws InvalidConfigurationException {
192192
Buffer configData = new Buffer();
193193
try {
194194
configSource.readAll(configData);
195+
mConfigHash = configData.sha256().base64();
195196
mConfigJson = new JSONObject(configData.readString(Charset.forName("UTF-8")));
196197
} catch (IOException ex) {
197198
throw new InvalidConfigurationException(
@@ -201,7 +202,6 @@ private void readConfiguration() throws InvalidConfigurationException {
201202
"Unable to parse configuration: " + ex.getMessage());
202203
}
203204

204-
mConfigHash = configData.sha256().base64();
205205
mClientId = getConfigString("client_id");
206206
mScope = getRequiredConfigString("authorization_scope");
207207
mRedirectUri = getRequiredConfigUri("redirect_uri");

build.gradle

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ apply from: 'config/keystore.gradle'
44

55
buildscript {
66
repositories {
7-
gradlePluginPortal()
87
google()
8+
mavenCentral()
9+
gradlePluginPortal()
910
}
1011
dependencies {
11-
classpath 'com.android.tools.build:gradle:8.0.1'
12+
classpath 'com.android.tools.build:gradle:8.9.0'
1213
classpath 'org.ajoberstar.grgit:grgit-gradle:4.1.1'
13-
classpath 'org.jacoco:org.jacoco.core:0.8.7'
14+
classpath 'org.jacoco:org.jacoco.core:0.8.10'
1415
}
1516
}
1617

@@ -19,6 +20,12 @@ subprojects {
1920
google()
2021
mavenCentral()
2122
}
23+
24+
tasks.configureEach { task ->
25+
if (task.name.contains("androidJavadoc")) {
26+
task.enabled = false
27+
}
28+
}
2229
}
2330

2431
ext.verifyKeystore()
@@ -40,11 +47,11 @@ try {
4047
}
4148

4249
project.ext {
43-
minSdkVersion = 16
44-
compileSdkVersion = 33
50+
minSdkVersion = 21
51+
compileSdkVersion = 34
4552

4653
googleVersions = [
47-
glide : '4.12.0',
54+
glide : '4.16.0',
4855
material : '1.3.0',
4956
]
5057

@@ -58,7 +65,7 @@ project.ext {
5865
jodaVersion = '2.10.10'
5966
}
6067

61-
task showVersion {
68+
tasks.register('showVersion') {
6269
doLast {
6370
logger.lifecycle("Version ID: " + project.versionNum)
6471
logger.lifecycle("Version Name: " + project.versionName)

config/android-common.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ android {
44
defaultConfig {
55
minSdkVersion rootProject.minSdkVersion
66
targetSdkVersion rootProject.compileSdkVersion
7-
versionCode rootProject.versionNum
8-
versionName rootProject.versionName
97
}
108
sourceSets {
119
main.manifest.srcFile 'AndroidManifest.xml'
@@ -21,14 +19,6 @@ android {
2119
sourceCompatibility JavaVersion.VERSION_1_8
2220
targetCompatibility JavaVersion.VERSION_1_8
2321
}
24-
lintOptions {
25-
warningsAsErrors true
26-
disable 'InvalidPackage', 'TrulyRandom', 'UseCompoundDrawables', 'GradleDependency'
27-
}
28-
packagingOptions {
29-
exclude 'META-INF/LICENSE.txt'
30-
exclude 'META-INF/NOTICE.txt'
31-
}
3222
}
3323

3424
// produces just the classes JAR

gradle/wrapper/gradle-wrapper.jar

-14.8 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
#Sat Jun 13 20:20:21 CEST 2020
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
26
zipStoreBase=GRADLE_USER_HOME
37
zipStorePath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip

0 commit comments

Comments
 (0)