List of usage examples for android.accounts AccountManager KEY_ACCOUNT_AUTHENTICATOR_RESPONSE
String KEY_ACCOUNT_AUTHENTICATOR_RESPONSE
To view the source code for android.accounts AccountManager KEY_ACCOUNT_AUTHENTICATOR_RESPONSE.
Click Source Link
From source file:com.manning.androidhacks.hack023.authenticator.Authenticator.java
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.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; }
From source file:pt.up.mobile.authenticator.Authenticator.java
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) { Log.v(TAG, "addAccount()"); final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:org.ohmage.auth.Authenticator.java
@Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) { // TODO: decide if we should allow more than one account, and if not, make it clear to the // user that they need to logout and login with a new account final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, accountType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.nextgis.maplibui.activity.NGWLoginActivity.java
@Override protected void onCreate(Bundle icicle) { Bundle extras = this.getIntent().getExtras(); if (extras != null) { if (extras.containsKey(FOR_NEW_ACCOUNT)) { mForNewAccount = extras.getBoolean(FOR_NEW_ACCOUNT); }// www. j av a2s . c o m if (!mForNewAccount) { if (extras.containsKey(ACCOUNT_URL_TEXT)) { mUrlText = extras.getString(ACCOUNT_URL_TEXT); } if (extras.containsKey(ACCOUNT_LOGIN_TEXT)) { mLoginText = extras.getString(ACCOUNT_LOGIN_TEXT); } if (extras.containsKey(CHANGE_ACCOUNT_URL)) { mChangeAccountUrl = extras.getBoolean(CHANGE_ACCOUNT_URL); } if (extras.containsKey(CHANGE_ACCOUNT_LOGIN)) { mChangeAccountLogin = extras.getBoolean(CHANGE_ACCOUNT_LOGIN); } setTitle(R.string.action_edit); } } super.onCreate(icicle); mAccountAuthenticatorResponse = getIntent() .getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } createView(); }
From source file:com.pindroid.authenticator.AuthenticatorActivity.java
/** * {@inheritDoc}//ww w .j a v a2 s .c om */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mAccountAuthenticatorResponse = getIntent() .getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } mAccountManager = AccountManager.get(this); final Intent intent = getIntent(); mUsername = intent.getStringExtra(PARAM_USERNAME); mRequestNewAccount = mUsername == null; mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false); setContentView(R.layout.login_activity); mMessage = (TextView) findViewById(R.id.message); mUsernameEdit = (EditText) findViewById(R.id.username_edit); mPasswordEdit = (EditText) findViewById(R.id.password_edit); mPasswordEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { startLogin(); return true; } else { return false; } } }); if (!TextUtils.isEmpty(mUsername)) { mUsernameEdit.setText(mUsername); mPasswordEdit.requestFocus(); } }
From source file:com.ntsync.android.sync.activities.AbstractAuthenticatorActivity.java
/** * Retreives the AccountAuthenticatorResponse from either the intent of the * icicle, if the icicle is non-zero.// ww w.j av a2 s .c om * * @param icicle * the save instance data of this Activity, may be null */ @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); mAccountAuthenticatorResponse = getIntent() .getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } }
From source file:org.klnusbaum.udj.auth.Authenticator.java
@Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle loginOptions) {//from w w w .ja v a2 s . c o m final AccountManager am = AccountManager.get(context); final String password = am.getPassword(account); if (password != null) { try { final ServerConnection.AuthResult authResult = ServerConnection.authenticate(account.name, password); if (!TextUtils.isEmpty(authResult.ticketHash)) { am.setUserData(account, Constants.USER_ID_DATA, authResult.userId); return bundleUpAuthToken(account, authResult.ticketHash); } } catch (AuthenticationException e) { //TODO actually do something with this exception } catch (IOException e) { //TODO actually do something with this exception } catch (JSONException e) { //TODO actually do something with this exception } catch (APIVersionException e) { final Intent intent = new Intent(context, NeedUpdateActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); intent.putExtra(AccountManager.KEY_ERROR_CODE, Constants.AUTH_API_VERSION_ERROR); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; } } //Oh snap, they're username and password didn't work. O well, better have // them sort it out. final Intent intent = new Intent(context, AuthActivity.class); intent.putExtra(AuthActivity.PARAM_USERNAME, account.name); intent.putExtra(AuthActivity.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; }
From source file:com.ubuntuone.android.files.activity.LoginActivity.java
/** * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) *///www . ja v a2 s . c o m @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_content); final Intent intent = getIntent(); if (intent == null) { Log.e(TAG, "This activity intended to be instantiated via an Intent."); finish(); return; } mAccountAuthenticatorResponse = intent .getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } int fragmentToShow = FRAGMENT_SIGN_IN_OR_UP; final String action = intent.getAction(); if (ACTION_VALIDATE.equals(action) && savedInstanceState == null) { showValidateFragment(true); return; } final AccountManager accountManager = AccountManager.get(this); final Account account = Preferences.getAccount(accountManager); if (account != null && savedInstanceState == null) { fragmentToShow = FRAGMENT_SIGN_IN; final String hint = accountManager.getUserData(account, Constants.KEY_AUTHTOKEN_HINT); final String oauthData = accountManager.peekAuthToken(account, Constants.AUTH_TOKEN_TYPE); if (oauthData == null && hint != null) { fragmentToShow = FRAGMENT_VALIDATE; } else if (oauthData != null && mAccountAuthenticatorResponse != null) { UIUtil.showToast(this, R.string.sso_only_one_supported, true); finish(); return; } } if (savedInstanceState != null) { // Android will re-add the fragment automatically. return; } switch (fragmentToShow) { case FRAGMENT_VALIDATE: showValidateFragment(false); break; case FRAGMENT_SIGN_IN_OR_UP: showSignInOrUpFragment(); break; case FRAGMENT_SIGN_IN: ChangeLogUtils.maybeShowChangelog(this); showSignInFragment(false); break; default: break; } }
From source file:edu.mit.mobile.android.locast.accounts.Authenticator.java
/** * {@inheritDoc}/* w ww. j a va2 s . c om*/ */ @Override public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) { if (options != null && options.containsKey(AccountManager.KEY_PASSWORD)) { final String password = options.getString(AccountManager.KEY_PASSWORD); final Bundle verified = onlineConfirmPassword(account, password); final Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, verified != null); return result; } // Launch AuthenticatorActivity to confirm credentials final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.EXTRA_USERNAME, account.name); intent.putExtra(AuthenticatorActivity.EXTRA_CONFIRMCREDENTIALS, true); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:com.github.baoti.git.accounts.AccountAuthenticatorActivity.java
/** * Retreives the AccountAuthenticatorResponse from either the intent of the icicle, if the * icicle is non-zero./*from www.jav a2s . c o m*/ * @param icicle the save instance data of this Activity, may be null */ protected void onCreate(Bundle icicle) { super.onCreate(icicle); mAccountAuthenticatorResponse = getIntent() .getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } if (icicle == null) { String fragmentClass = getIntent().getStringExtra(EXTRA_FRAGMENT_CLASS); getSupportFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_NONE) .add(android.R.id.content, Fragment.instantiate(this, fragmentClass)).commit(); } }