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
5 changes: 4 additions & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/analysis/findbugs-results.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
439
436
8 changes: 0 additions & 8 deletions src/gplay/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/Theme.ownCloud.noActionBar.Login">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="@string/oauth2_redirect_scheme" />
</intent-filter>
<intent-filter>
<action android:name="com.owncloud.android.workaround.accounts.CREATE" />

Expand Down
8 changes: 0 additions & 8 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,6 @@
android:launchMode="singleTask"
android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@style/Theme.ownCloud.noActionBar.Login">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="@string/oauth2_redirect_scheme" />
</intent-filter>
<intent-filter>
<action android:name="com.owncloud.android.workaround.accounts.CREATE" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,6 @@ private Account migrateAccount(Context context, Account currentAccount, AccountM
accountMgr.getUserData(account, com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_COOKIES)
);

// copy type of authentication
final String isSamlStr = accountMgr.getUserData(account, com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO);
if (Boolean.parseBoolean(isSamlStr)) {
accountMgr.setUserData(newAccount, com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO, "TRUE");
}

final String isOauthStr = accountMgr.getUserData(account, com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_SUPPORTS_OAUTH2);
if (Boolean.parseBoolean(isOauthStr)) {
accountMgr.setUserData(newAccount, com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_SUPPORTS_OAUTH2, "TRUE");
}

/* TODO - study if it's possible to run this method in a background thread to copy the authToken
if (isOAuth || isSaml) {
accountMgr.setAuthToken(newAccount, mAuthTokenType, mAuthToken);
}
*/

// don't forget the account saved in preferences as the current one
if (currentAccount.name.equals(account.name)) {
AccountUtils.setCurrentOwnCloudAccount(context, newAccountName);
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/com/owncloud/android/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import com.owncloud.android.jobs.MediaFoldersDetectionJob;
import com.owncloud.android.jobs.NCJobCreator;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory;
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory.Policy;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
import com.owncloud.android.ui.activity.ContactsPreferenceActivity;
Expand Down Expand Up @@ -198,16 +197,8 @@ public void onCreate() {

MainApp.storagePath = preferences.getStoragePath(getApplicationContext().getFilesDir().getAbsolutePath());

boolean isSamlAuth = AUTH_ON.equals(getString(R.string.auth_method_saml_web_sso));

OwnCloudClientManagerFactory.setUserAgent(getUserAgent());
OwnCloudClientManagerFactory.setNextcloudUserAgent(getNextcloudUserAgent());
if (isSamlAuth) {
OwnCloudClientManagerFactory.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT);
} else {
OwnCloudClientManagerFactory
.setDefaultPolicy(Policy.SINGLE_SESSION_PER_ACCOUNT_IF_SERVER_SUPPORTS_SERVER_MONITORING);
}

// initialise thumbnails cache on background thread
new ThumbnailsCacheManager.InitDiskCacheTask().execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@

/**
* Authenticator for ownCloud accounts.
*
*
* Controller class accessed from the system AccountManager,
* providing integration of ownCloud accounts with the Android system.
*
*
* TODO - better separation in operations for OAuth-capable and regular ownCloud accounts.
* TODO - review completeness
*/
public class AccountAuthenticator extends AbstractAccountAuthenticator {

/**
* Is used by android system to assign accounts to authenticators.
* Should be used by application and all extensions.
Expand All @@ -59,9 +59,9 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
public static final String KEY_ACCOUNT = "account";

private static final String TAG = AccountAuthenticator.class.getSimpleName();

private Context mContext;

private Handler mHandler;

public AccountAuthenticator(Context context) {
Expand Down Expand Up @@ -101,17 +101,17 @@ public Bundle addAccount(AccountAuthenticatorResponse response,
intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_CREATE);

setIntentFlags(intent);

bundle.putParcelable(AccountManager.KEY_INTENT, intent);
} else {
// Return an error
bundle.putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION);
final String message = String.format(mContext.getString(R.string.auth_unsupported_multiaccount), mContext.getString(R.string.app_name));
final String message = String.format(mContext.getString(R.string.auth_unsupported_multiaccount), mContext.getString(R.string.app_name));
bundle.putString(AccountManager.KEY_ERROR_MESSAGE, message);

mHandler.post(() -> Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show());
}

return bundle;
}

Expand Down Expand Up @@ -160,7 +160,7 @@ public Bundle getAuthToken(AccountAuthenticatorResponse response,
Log_OC.e(TAG, "Failed to validate account type " + account.type + ": " + e.getMessage(), e);
return e.getFailureBundle();
}

/// check if required token is stored
final AccountManager am = AccountManager.get(mContext);
String accessToken;
Expand All @@ -176,15 +176,15 @@ public Bundle getAuthToken(AccountAuthenticatorResponse response,
result.putString(AccountManager.KEY_AUTHTOKEN, accessToken);
return result;
}

/// if not stored, return Intent to access the AuthenticatorActivity and UPDATE the token for the account
Intent intent = new Intent(mContext, AuthenticatorActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
intent.putExtra(KEY_LOGIN_OPTIONS, options);
intent.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN);


final Bundle bundle = new Bundle();
bundle.putParcelable(AccountManager.KEY_INTENT, intent);
Expand Down Expand Up @@ -242,10 +242,7 @@ private void validateAuthTokenType(String authTokenType) throws UnsupportedAuthT
String accountType = MainApp.getAccountType(mContext);

if (!authTokenType.equals(accountType) &&
!authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(accountType)) &&
!authTokenType.equals(AccountTypeUtils.getAuthTokenTypeAccessToken(accountType)) &&
!authTokenType.equals(AccountTypeUtils.getAuthTokenTypeRefreshToken(accountType)) &&
!authTokenType.equals(AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(accountType))) {
!authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(accountType))) {
throw new UnsupportedAuthTokenTypeException();
}
}
Expand Down
Loading