android.accounts.AccountAuthenticatorResponse Java Examples
The following examples show how to use
android.accounts.AccountAuthenticatorResponse.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DummyAccountService.java From ChannelSurfer with MIT License | 6 votes |
@Override public Bundle addAccount(AccountAuthenticatorResponse accountAuthenticatorResponse, String s, String s2, String[] strings, Bundle options) throws NetworkErrorException { Log.d(TAG, "Trying to add an account"); final AccountManager accountManager = AccountManager.get(getApplicationContext()); String ACCOUNT_NAME = getApplicationContext().getString(R.string.app_name); Account[] accounts = accountManager.getAccountsByType(ACCOUNT_NAME); Log.d(TAG, accounts.length+"accounts"); Log.d(TAG, accounts[0].toString()); if(accounts.length > 0) { final Intent intent = new Intent(getApplicationContext(), DummyAccountIgnoreActivity.class); intent.putExtra(DummyAccountIgnoreActivity.INTENT_ACTION, DummyAccountIgnoreActivity.ACTION_ADD); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; } else { return null; } }
Example #2
Source File: OAuthAuthenticator.java From auth with MIT License | 6 votes |
private void returnResultToQueuedResponses(Account account, ResponseCallback callback) { for (; ; ) { List<AccountAuthenticatorResponse> q; synchronized (this) { final FetchingAuthModel authModel = activeLookups.get(account); q = authModel.queue; if (q == null) { authModel.fetchingToken = false; return; } authModel.queue = null; } for (AccountAuthenticatorResponse r : q) { callback.returnResult(r); } } }
Example #3
Source File: AccountAuthenticator.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response, Account account) throws NetworkErrorException { final Bundle result = super.getAccountRemovalAllowed(response, account); if (result != null && result.containsKey(AccountManager.KEY_BOOLEAN_RESULT) && !result.containsKey(AccountManager.KEY_INTENT)) { if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT)) { accountManager.logout() .doOnError(throwable -> crashReport.log(throwable)) .onErrorComplete() .subscribe(); } } return result; // // this indicates that the user must explicitly logout inside Aptoide and is not able to // logout from the Settings -> Accounts // //Bundle result = new Bundle(); //result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false); //return result; }
Example #4
Source File: AppAccountAuthenticator.java From account-authenticator with Apache License 2.0 | 6 votes |
@Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { AuthenticatorManager authenticatorManager = AuthenticatorManager.authenticatorManager; Bundle result; AccountManager accountManager = AccountManager.get(context); // case 1: access token is available result = authenticatorManager.getAccessTokenFromCache(account, authTokenType, accountManager); if (result != null) { return result; } final String refreshToken = accountManager.getPassword(account); // case 2: access token is not available but refresh token is if (refreshToken != null) { result = authenticatorManager.makeResultBundle(account, refreshToken, null); return result; } // case 3: neither tokens is available but the account exists if (isAccountAvailable(account, accountManager)) { result = authenticatorManager.makeResultBundle(account, null, null); return result; } // case 4: account does not exist return new Bundle(); }
Example #5
Source File: HackerNewsAuthenticator.java From PhilHackerNews with MIT License | 5 votes |
@Override public Bundle updateCredentials( AccountAuthenticatorResponse r, Account account, String s, Bundle bundle) throws NetworkErrorException { throw new UnsupportedOperationException(); }
Example #6
Source File: AccountAuthenticator.java From cathode with Apache License 2.0 | 5 votes |
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { AccountManager manager = AccountManager.get(context); final Account account = new Account(context.getString(R.string.accountName), context.getPackageName()); manager.addAccountExplicitly(account, null, null); return null; }
Example #7
Source File: PredatorAuthenticator.java From Capstone-Project with MIT License | 5 votes |
@Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { // Check if the context was null or not. if (mContextWeakReference.get() == null) { return null; } // Check if any authToken is available or not. AccountManager accountManager = AccountManager.get(mContextWeakReference.get()); String authToken = accountManager.peekAuthToken(account, authTokenType); // If the authToken is available, return it. if (!TextUtils.isEmpty(authToken)) { Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type); result.putString(AccountManager.KEY_AUTHTOKEN, authToken); return result; } // If the authToken is unavailable, retry for a new one. Intent intent = new Intent(mContextWeakReference.get(), AuthenticatorActivity.class); intent.putExtra(Constants.Authenticator.ACCOUNT_TYPE, account.type); intent.putExtra(Constants.Authenticator.AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
Example #8
Source File: Authenticator.java From android-clean-sample-app with MIT License | 5 votes |
@Override public Bundle confirmCredentials( AccountAuthenticatorResponse r, Account account, Bundle bundle) throws NetworkErrorException { return null; }
Example #9
Source File: BasicAccountAuthenticator.java From Mover with Apache License 2.0 | 5 votes |
@Override @DebugLog public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) throws NetworkErrorException { Intent intent = new Intent(ACTION_CONFIRM_CREDENTIALS) .putExtra(EXTRA_ACCOUNT, account) .putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response) .putExtras(options); mExtras.clear(); mExtras.putParcelable(KEY_INTENT, intent); return mExtras; }
Example #10
Source File: AppAccountAuthenticator.java From account-authenticator with Apache License 2.0 | 5 votes |
@NonNull private Intent makeIntent(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) { Intent intent = new Intent(context, registrationActivityClass); intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType); intent.putExtra(AuthenticatorManager.KEY_AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); intent.putExtra(AuthenticatorManager.KEY_REQUIRED_FEATURES, requiredFeatures); intent.putExtra(AuthenticatorManager.KEY_AUTH_ACCOUNT_OPTIONS, options); return intent; }
Example #11
Source File: NGWAccountAuthenticator.java From android_maplibui with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Bundle hasFeatures( AccountAuthenticatorResponse accountAuthenticatorResponse, Account account, String[] strings) throws NetworkErrorException { return null; }
Example #12
Source File: NGWAccountAuthenticator.java From android_maplibui with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Bundle editProperties( AccountAuthenticatorResponse accountAuthenticatorResponse, String s) { return null; }
Example #13
Source File: AccountAuthenticator.java From Pioneer with Apache License 2.0 | 5 votes |
@Override public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) throws NetworkErrorException { Bundle result = new Bundle(); boolean pass = true; if (features != null) { for (String feature : features) { if (!FEATURE_READ_NEWS.equals(feature)) { pass = false; break; } } } result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, pass); return result; }
Example #14
Source File: OAuthAuthenticator.java From auth with MIT License | 5 votes |
@Override public Bundle hasFeatures( @NonNull AccountAuthenticatorResponse response, @NonNull Account account, @NonNull String[] features) throws NetworkErrorException { log("hasFeatures for %s and %s", account, Arrays.toString(features)); return null; }
Example #15
Source File: DummyAccountService.java From ChannelSurfer with MIT License | 5 votes |
@Override public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response, Account account) throws NetworkErrorException { final Bundle result = new Bundle(); // final Intent intent = new Intent(getApplicationContext(), DummyAccountIgnoreActivity.class); // intent.putExtra(DummyAccountIgnoreActivity.INTENT_ACTION, DummyAccountIgnoreActivity.ACTION_REMOVE); Log.d(TAG, "Somebody is trying to delete this account"); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false); // result.putParcelable(AccountManager.KEY_INTENT, intent); return result; }
Example #16
Source File: AccountAuthenticatorService.java From kolabnotes-android with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Intent intent = new Intent(context, AuthenticatorActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
Example #17
Source File: Authenticator.java From QuantumFlux with Apache License 2.0 | 5 votes |
@Override public Bundle getAuthToken( AccountAuthenticatorResponse r, Account account, String s, Bundle bundle) throws NetworkErrorException { throw new UnsupportedOperationException(); }
Example #18
Source File: Authenticator.java From narrate-android with Apache License 2.0 | 5 votes |
@Override public Bundle updateCredentials( AccountAuthenticatorResponse r, Account account, String s, Bundle bundle) throws NetworkErrorException { return null; }
Example #19
Source File: SunshineAuthenticator.java From Advanced_Android_Development with Apache License 2.0 | 5 votes |
@Override public Bundle addAccount( AccountAuthenticatorResponse r, String s, String s2, String[] strings, Bundle bundle) throws NetworkErrorException { return null; }
Example #20
Source File: Authenticator.java From palmsuda with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) { final Intent intent = new Intent(mContext, NPersoncenterAvtivity.class); intent.putExtra(NPersoncenterAvtivity.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
Example #21
Source File: WoodminAuthenticator.java From Woodmin with Apache License 2.0 | 5 votes |
@Override public Bundle updateCredentials( AccountAuthenticatorResponse r, Account account, String s, Bundle bundle) throws NetworkErrorException { throw new UnsupportedOperationException(); }
Example #22
Source File: SunshineAuthenticator.java From Krishi-Seva with MIT License | 5 votes |
@Override public Bundle addAccount( AccountAuthenticatorResponse r, String s, String s2, String[] strings, Bundle bundle) throws NetworkErrorException { return null; }
Example #23
Source File: Authenticator.java From WeGit with Apache License 2.0 | 5 votes |
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { final Intent intent = new Intent(context, LoginActivity.class); intent.putExtra(ARG_ACCOUNT_TYPE, accountType); intent.putExtra(ARG_AUTH_TYPE, authTokenType); intent.putExtra(ARG_IS_ADDING_NEW_ACCOUNT, true); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
Example #24
Source File: StubAuthenticator.java From COCOFramework with Apache License 2.0 | 5 votes |
@Override public Bundle confirmCredentials( AccountAuthenticatorResponse r, Account account, Bundle bundle) throws NetworkErrorException { return null; }
Example #25
Source File: BaseAuthenticator.java From android-atleap with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Log.v(TAG, "Adding account: type=" + accountType); return createAuthActivityIntentBundle(response, null, accountType, authTokenType, null, options); }
Example #26
Source File: OAuthAuthenticator.java From auth with MIT License | 5 votes |
@Override public Bundle getAuthToken( @NonNull final AccountAuthenticatorResponse response, @NonNull final Account account, @NonNull final String authTokenType, @Nullable final Bundle options) throws NetworkErrorException { log( "getAuthToken for %s as %s with options %s", account, authTokenType, BundleUtil.toString(options)); if (isAnotherThreadHandlingIt(account, response)) return null; final String authToken = accountManager.peekAuthToken(account, authTokenType); if (TextUtils.isEmpty(authToken)) { synchronized (this) { // queue as well isAnotherThreadHandlingIt(account, response); } final String refreshToken = accountManager.getPassword(account); CallbackListener listener = new CallbackListener(account, authTokenType, service); listener.refresh(refreshToken); } else { final Bundle resultBundle = createResultBundle(account, authToken); returnResultToQueuedResponses(account, (r) -> r.onResult(resultBundle)); return resultBundle; } // return result via response async return null; }
Example #27
Source File: AccountAuthenticator.java From aptoide-client with GNU General Public License v2.0 | 5 votes |
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { Log.d("udinic", TAG + "> addAccount"); final Intent intent = new Intent(mContext, LoginActivity.class); intent.putExtra(LoginActivity.ARG_ACCOUNT_TYPE, accountType); intent.putExtra(LoginActivity.ARG_AUTH_TYPE, authTokenType); intent.putExtra(LoginActivity.ARG_IS_ADDING_NEW_ACCOUNT, true); intent.putExtra(LoginActivity.ARG_OPTIONS_BUNDLE, options); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); if(!ArrayUtils.isEmpty(requiredFeatures) && ArrayUtils.contains(requiredFeatures, "timelineLogin")){ String username = options.getString(AccountManager.KEY_ACCOUNT_NAME); String password = options.getString(AccountManager.KEY_PASSWORD); String authToken = options.getString(AccountManager.KEY_AUTHTOKEN); Account account = new Account(username, accountType); AccountManager.get(mContext).addAccountExplicitly(account, password, null); AccountManager.get(mContext).setAuthToken(account, authTokenType, authToken); Bundle data = new Bundle(); data.putString(AccountManager.KEY_ACCOUNT_NAME, username); data.putString(AccountManager.KEY_ACCOUNT_TYPE, accountType); response.onResult(data); }else{ bundle.putParcelable(AccountManager.KEY_INTENT, intent); } return bundle; }
Example #28
Source File: Authenticator.java From linphone-android with GNU General Public License v3.0 | 4 votes |
@Override public Bundle editProperties(AccountAuthenticatorResponse r, String s) { throw new UnsupportedOperationException(); }
Example #29
Source File: AuthenticatorService.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { return null; }
Example #30
Source File: AuthenticatorService.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) throws NetworkErrorException { return null; }