Skip to content

Commit

Permalink
Merge pull request #13695 from nextcloud/removeFido
Browse files Browse the repository at this point in the history
Remove fido since we do not need it with login flow v2
  • Loading branch information
alperozturk96 authored Oct 8, 2024
2 parents 0bfff99 + 92e822c commit dd78d22
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 72 deletions.
3 changes: 0 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,6 @@ dependencies {
implementation 'androidx.annotation:annotation:1.8.2'
implementation 'com.vanniktech:emoji-google:0.21.0'

implementation "com.github.nextcloud-deps.hwsecurity:hwsecurity-fido:$fidoVersion"
implementation "com.github.nextcloud-deps.hwsecurity:hwsecurity-fido2:$fidoVersion"

// document scanner not available on FDroid (generic) due to OpenCV binaries
gplayImplementation project(':appscan')
huaweiImplementation project(':appscan')
Expand Down
35 changes: 0 additions & 35 deletions app/src/main/java/com/owncloud/android/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.RestrictionsManager;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
Expand Down Expand Up @@ -64,7 +63,6 @@
import com.nextcloud.receiver.NetworkChangeReceiver;
import com.nextcloud.utils.extensions.ContextExtensionsKt;
import com.nmc.android.ui.LauncherActivity;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.authentication.PassCodeManager;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
Expand Down Expand Up @@ -121,8 +119,6 @@
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasAndroidInjector;
import de.cotech.hw.SecurityKeyManager;
import de.cotech.hw.SecurityKeyManagerConfig;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import static com.owncloud.android.ui.activity.ContactsPreferenceActivity.PREFERENCE_CONTACTS_AUTOMATIC_BACKUP;
Expand Down Expand Up @@ -317,8 +313,6 @@ public void onCreate() {

insertConscrypt();

initSecurityKeyManager();

registerActivityLifecycleCallbacks(new ActivityInjector());

//update the app restart count when app is launched by the user
Expand Down Expand Up @@ -476,35 +470,6 @@ public void onActivityDestroyed(@NonNull Activity activity) {
});
}

@SuppressWarnings("unchecked")
private void initSecurityKeyManager() {
SecurityKeyManager securityKeyManager = SecurityKeyManager.getInstance();
final SecurityKeyManagerConfig.Builder configBuilder = new SecurityKeyManagerConfig.Builder()
.setEnableDebugLogging(BuildConfig.DEBUG);

try {
// exclude all activities except AuthenticatorActivity
final PackageManager pm = this.getPackageManager();
final PackageInfo info = pm.getPackageInfo(this.getPackageName(), PackageManager.GET_ACTIVITIES);
final ActivityInfo[] activities = info.activities;
for (ActivityInfo activityInfo : activities) {
try {
final Class<? extends Activity> aClass = (Class<? extends Activity>) Class.forName(activityInfo.name);
if (aClass != AuthenticatorActivity.class) {
configBuilder.addExcludedActivityClass(aClass);
}
} catch (ClassNotFoundException | ClassCastException e) {
Log_OC.e(TAG, "Couldn't disable activity for security key listener", e);
}
}
} catch (PackageManager.NameNotFoundException e) {
Log_OC.e(TAG, "Couldn't disable activities for security key listener", e);
}


securityKeyManager.init(this, configBuilder.build());
}

public static void initContactsBackup(UserAccountManager accountManager, BackgroundJobManager backgroundJobManager) {
ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProviderImpl(appContext.get());
if (accountManager == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.ProcessLifecycleOwner;
import de.cotech.hw.fido.WebViewFidoBridge;
import de.cotech.hw.fido.ui.FidoDialogOptions;
import de.cotech.hw.fido2.WebViewWebauthnBridge;
import de.cotech.hw.fido2.ui.WebauthnDialogOptions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import okhttp3.FormBody;
import okhttp3.RequestBody;
Expand Down Expand Up @@ -230,9 +226,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private GetServerInfoOperation.ServerInfo mServerInfo = new GetServerInfoOperation.ServerInfo();

/// Authentication PRE-Fragment elements
private WebViewFidoBridge webViewFidoU2fBridge;
private WebViewWebauthnBridge webViewWebauthnBridge;

private String mAuthStatusText = EMPTY_STRING;
private int mAuthStatusIcon;

Expand Down Expand Up @@ -521,19 +514,6 @@ private void initWebViewLogin(String baseURL, boolean useGenericUserAgent) {
accountSetupWebviewBinding.loginWebview.getSettings().setSaveFormData(false);
accountSetupWebviewBinding.loginWebview.getSettings().setSavePassword(false);

FidoDialogOptions.Builder dialogOptionsBuilder = FidoDialogOptions.builder();
dialogOptionsBuilder.setShowSdkLogo(true);
dialogOptionsBuilder.setTheme(R.style.FidoDialog);
webViewFidoU2fBridge = WebViewFidoBridge.createInstanceForWebView(
this, accountSetupWebviewBinding.loginWebview, dialogOptionsBuilder);

WebauthnDialogOptions.Builder webauthnOptionsBuilder = WebauthnDialogOptions.builder();
webauthnOptionsBuilder.setShowSdkLogo(true);
webauthnOptionsBuilder.setAllowSkipPin(true);
webauthnOptionsBuilder.setTheme(R.style.FidoDialog);
webViewWebauthnBridge = WebViewWebauthnBridge.createInstanceForWebView(
this, accountSetupWebviewBinding.loginWebview, webauthnOptionsBuilder);

Map<String, String> headers = new HashMap<>();
headers.put(RemoteOperation.OCS_API_HEADER, RemoteOperation.OCS_API_HEADER_VALUE);

Expand Down Expand Up @@ -572,16 +552,12 @@ private void setClient() {
accountSetupWebviewBinding.loginWebview.setWebViewClient(new NextcloudWebViewClient(getSupportFragmentManager()) {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
webViewFidoU2fBridge.delegateShouldInterceptRequest(view, request);
webViewWebauthnBridge.delegateShouldInterceptRequest(view, request);
return super.shouldInterceptRequest(view, request);
}

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
webViewFidoU2fBridge.delegateOnPageStarted(view, url, favicon);
webViewWebauthnBridge.delegateOnPageStarted(view, url, favicon);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/dialog_set_status.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
android:layout_marginEnd="@dimen/standard_half_margin"
android:contentDescription="@null"
android:src="@drawable/online_status"
app:tint="@color/hwSecurityGreen" />
app:tint="@color/online" />

<LinearLayout
android:layout_width="match_parent"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<color name="process_dialog_background">#ffffff</color>
<color name="indicator_dot_selected">#ffffff</color>
<color name="drawer_shadow">#000000</color>
<color name="online">#2d7b41</color>

<color name="background_color_png">#FFFFFF</color>

Expand Down
8 changes: 0 additions & 8 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
<style name="ThemeOverlay.App.TextInputLayout" parent="ThemeOverlay.Material3.TextInputEditText.OutlinedBox">
<item name="colorPrimary">@color/text_color</item>
<item name="colorOnSurface">@color/text_color</item>
<item name="colorError">@color/hwSecurityRed</item>
<item name="editTextStyle">@style/Widget.Material3.TextInputEditText.OutlinedBox</item>
</style>

Expand Down Expand Up @@ -335,7 +334,6 @@
<style name="ThemeOverlay.App.Login.TextInputLayout" parent="">
<item name="colorPrimary">@color/white</item>
<item name="colorOnSurface">@color/white</item>
<item name="colorError">@color/hwSecurityRed</item>
<item name="textAppearanceSubtitle1">@style/TextAppearance.Material3.BodyLarge</item>
<item name="textAppearanceCaption">@style/TextAppearance.Material3.BodySmall</item>
<item name="editTextStyle">@style/Widget.Material3.TextInputEditText.OutlinedBox</item>
Expand Down Expand Up @@ -415,12 +413,6 @@
<item name="iconPadding">0dp</item>
</style>

<!-- Custom colors for the FIDO dialog -->
<style name="FidoDialog" parent="HwSecurity.Dialog">
<item name="hwSecurityButtonColor">@color/color_accent</item>
<item name="hwSecuritySurfaceColor">@color/primary</item>
</style>

<style name="Nextcloud.Material.TextButton" parent="Widget.Material3.Button.TextButton.Icon">
<item name="android:typeface">sans</item>
<item name="android:textStyle">bold</item>
Expand Down
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ buildscript {
daggerVersion = "2.52"
documentScannerVersion = "1.1.1"
espressoVersion = "3.6.1"
fidoVersion = "4.1.0-patch2"
jacoco_version = '0.8.12'
kotlin_version = '2.0.20'
markwonVersion = "4.6.2"
Expand Down

0 comments on commit dd78d22

Please sign in to comment.