Add auth token to requests
This commit is contained in:
parent
e05dcba9b3
commit
c8c67f61c6
4 changed files with 7 additions and 28 deletions
|
@ -66,7 +66,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import de.luhmer.owncloud.accountimporter.helper.AccountImporter;
|
||||
import de.luhmer.owncloud.accountimporter.helper.NextcloudAPI;
|
||||
import de.luhmer.owncloud.accountimporter.helper.SingleAccount;
|
||||
import de.luhmer.owncloud.accountimporter.helper.SingleSignOnAccount;
|
||||
import de.luhmer.owncloud.accountimporter.interfaces.IAccountImport;
|
||||
import de.luhmer.owncloudnewsreader.authentication.AuthenticatorActivity;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
|
||||
|
@ -129,7 +129,7 @@ public class LoginDialogFragment extends DialogFragment implements IAccountImpor
|
|||
@Override
|
||||
public void accountAccessGranted(final Account account) {
|
||||
try {
|
||||
SingleAccount singleAccount = AccountImporter.BlockingGetAuthToken(getActivity(), account);
|
||||
SingleSignOnAccount singleAccount = AccountImporter.BlockingGetAuthToken(getActivity(), account);
|
||||
mUsernameView.setText(singleAccount.username);
|
||||
mPasswordView.setText(singleAccount.password);
|
||||
mOc_root_path_View.setText(singleAccount.url);
|
||||
|
|
|
@ -3,41 +3,22 @@ package de.luhmer.owncloudnewsreader.di;
|
|||
import android.accounts.Account;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
|
||||
import de.luhmer.owncloud.accountimporter.helper.AccountImporter;
|
||||
import de.luhmer.owncloud.accountimporter.helper.NextcloudAPI;
|
||||
import de.luhmer.owncloud.accountimporter.helper.SingleSignOnAccount;
|
||||
import de.luhmer.owncloudnewsreader.SettingsActivity;
|
||||
import de.luhmer.owncloudnewsreader.database.model.Feed;
|
||||
import de.luhmer.owncloudnewsreader.database.model.Folder;
|
||||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||
import de.luhmer.owncloudnewsreader.helper.GsonConfig;
|
||||
import de.luhmer.owncloudnewsreader.model.UserInfo;
|
||||
import de.luhmer.owncloudnewsreader.reader.OkHttpImageDownloader;
|
||||
import de.luhmer.owncloudnewsreader.reader.nextcloud.API;
|
||||
import de.luhmer.owncloudnewsreader.reader.nextcloud.API_SSO;
|
||||
import de.luhmer.owncloudnewsreader.reader.nextcloud.NextcloudDeserializer;
|
||||
import de.luhmer.owncloudnewsreader.reader.nextcloud.Types;
|
||||
import de.luhmer.owncloudnewsreader.ssl.MemorizingTrustManager;
|
||||
import de.luhmer.owncloudnewsreader.ssl.OkHttpSSLClient;
|
||||
import okhttp3.HttpUrl;
|
||||
|
@ -108,8 +89,9 @@ public class ApiProvider {
|
|||
mApi = retrofit.create(API.class);
|
||||
}
|
||||
|
||||
private void initSsoApi(Account account, NextcloudAPI.ApiConnectedListener callback) {
|
||||
NextcloudAPI nextcloudAPI = new NextcloudAPI(account, GsonConfig.GetGson());
|
||||
private void initSsoApi(final Account account, final NextcloudAPI.ApiConnectedListener callback) {
|
||||
SingleSignOnAccount ssoAccount = AccountImporter.GetAuthTokenInSeperateThread(context, account);
|
||||
NextcloudAPI nextcloudAPI = new NextcloudAPI(ssoAccount, GsonConfig.GetGson());
|
||||
nextcloudAPI.start(context, callback);
|
||||
mApi = new API_SSO(nextcloudAPI);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package de.luhmer.owncloudnewsreader.reader.nextcloud;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7b49d9c391510125033c98afc5d6e35fc94cf678
|
||||
Subproject commit 9199f6c6ef0af541597de1955582c6f1c5f6c394
|
Loading…
Reference in a new issue