Skip to content

Commit

Permalink
SDKS-2988 Resolve the CVE-2023-52428 issue by upgrading the nimbus-jo…
Browse files Browse the repository at this point in the history
…se-jwt. Other enhancement are included in this PR:

1. Centralize the version in toml file.
2. Refactor Core and Auth module build.gradle file to build.gradle.kts
3. Since the root detector is moved to core, move the jni folder from auth to core.
4. introduce buildSrc to share common configuration.
5. Remove lombok from forgerock-auth-ui and remove doc and build for forgerock-auth-ui
  • Loading branch information
witrisna committed Feb 22, 2024
1 parent 07f649e commit 0570d49
Show file tree
Hide file tree
Showing 21 changed files with 421 additions and 332 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ buildscript {
customTemplatesFolder = file(projectDir.toString() + "/dokka/templates")
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.2'
classpath "com.adarshr:gradle-test-logger-plugin:2.0.0"
classpath 'com.google.gms:google-services:4.3.15'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gradle
build
19 changes: 19 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2024 ForgeRock. All rights reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

plugins {
`kotlin-dsl`
}

repositories {
google()
mavenCentral()
}

dependencies {
implementation("com.android.tools.build:gradle-api:8.2.2")
}
64 changes: 64 additions & 0 deletions buildSrc/src/main/kotlin/AndroidBuildGradlePlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2024 ForgeRock. All rights reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

import com.android.build.api.dsl.LibraryExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project

class AndroidBuildGradlePlugin: Plugin<Project> {

override fun apply(project: Project) {
project.android().apply {
compileSdk = 34;
defaultConfig {
minSdk = 23
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"),
("proguard-rules.pro"))
}
}
testOptions {
targetSdk = 34
unitTests {
isIncludeAndroidResources = true
}
unitTests.all {
it.exclude("**/*TestSuite*")
}
}

buildFeatures {
buildConfig = true
}

useLibrary("android.test.base")
useLibrary("android.test.mock")

defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

}
}

/**
* Extension function.
*/
private fun Project.android() : LibraryExtension {
return extensions.getByType(LibraryExtension::class.java)
}


}
5 changes: 1 addition & 4 deletions config/kdoc.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 ForgeRock. All rights reserved.
* Copyright (c) 2023-2024 ForgeRock. All rights reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
Expand All @@ -11,9 +11,6 @@ apply plugin: 'org.jetbrains.dokka'
/**
* Generate Kdoc, delombok then generate Javadoc
*/
configurations {
delombok
}

task delombok {
def srcJava = 'src/main/java'
Expand Down
8 changes: 0 additions & 8 deletions forgerock-auth-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ android {

}

apply from: '../config/kdoc.gradle'
apply from: '../config/publish.gradle'


dependencies {

api project(':forgerock-auth')
Expand All @@ -62,8 +58,4 @@ dependencies {

compileOnly 'com.google.android.gms:play-services-fido:20.0.1'

compileOnly "org.projectlombok:lombok:1.18.28"
delombok "org.projectlombok:lombok:1.18.28"
annotationProcessor 'org.projectlombok:lombok:1.18.28'

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 - 2023 ForgeRock. All rights reserved.
* Copyright (c) 2019 - 2024 ForgeRock. All rights reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
Expand Down Expand Up @@ -29,7 +29,6 @@
import kotlin.Result;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import lombok.Setter;

/**
* Reference implementation of handing Advice with {@link DialogFragment}
Expand All @@ -41,7 +40,10 @@ public class AdviceDialogFragment extends DialogFragment implements AuthHandler
private FRViewModel<FRSession> viewModel;
private boolean isCancel = true;

@Setter
public void setListener(Continuation<? super Unit> listener) {
this.listener = listener;
}

private Continuation<? super Unit> listener;
private PolicyAdvice advice;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 - 2020 ForgeRock. All rights reserved.
* Copyright (c) 2019 - 2024 ForgeRock. All rights reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
Expand All @@ -18,18 +18,26 @@
import org.forgerock.android.auth.NodeListener;
import org.forgerock.android.auth.PolicyAdvice;

import lombok.Getter;

/**
* {@link ViewModel} Wrapper for {@link FRUser}
*/
public abstract class FRViewModel<T> extends ViewModel {

@Getter
private MutableLiveData<SingleLiveEvent<Node>> nodeLiveData = new MutableLiveData<>();
@Getter
private MutableLiveData<T> resultLiveData = new MutableLiveData<>();
@Getter

public MutableLiveData<SingleLiveEvent<Node>> getNodeLiveData() {
return nodeLiveData;
}

public MutableLiveData<T> getResultLiveData() {
return resultLiveData;
}

public MutableLiveData<SingleLiveEvent<Exception>> getExceptionLiveData() {
return exceptionLiveData;
}

private MutableLiveData<SingleLiveEvent<Exception>> exceptionLiveData = new MutableLiveData<>();

private NodeListener nodeListener;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
/*
* Copyright (c) 2019 ForgeRock. All rights reserved.
* Copyright (c) 2019 - 2024 ForgeRock. All rights reserved.
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/

package org.forgerock.android.auth.ui;

import lombok.AllArgsConstructor;

/**
* Event only trigger once after configuration change.
*/
@AllArgsConstructor
public class SingleLiveEvent<T> {

private T value;

public SingleLiveEvent(T value) {
this.value = value;
}

public T getValue() {
T result = value;
value = null;
Expand Down
Loading

0 comments on commit 0570d49

Please sign in to comment.