package com.indieweb.indigenous.indieauth; import android.accounts.AbstractAccountAuthenticator; import android.accounts.Account; import android.accounts.AccountAuthenticatorResponse; import android.accounts.AccountManager; import android.content.Context; import android.content.Intent; import android.os.Bundle; public class Authenticator extends AbstractAccountAuthenticator { private final Context context; public Authenticator(Context context) { super(context); this.context = context; } @Override public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) { throw new UnsupportedOperationException(); } @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) { final Intent intent = new Intent(context, IndieAuthActivity.class); intent.putExtra("com.indieweb.indigenous.AccountType", accountType); intent.putExtra(IndieAuthActivity.TOKEN_TYPE, authTokenType); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; } @Override public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) { throw new UnsupportedOperationException(); } @Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) { throw new UnsupportedOperationException(); } @Override public String getAuthTokenLabel(String authTokenType) { return IndieAuthActivity.ACCOUNT_TYPE; } @Override public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) { throw new UnsupportedOperationException(); } @Override public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) { throw new UnsupportedOperationException(); } }