AndroidBootstrap:身份验证 - 它是如何工作的?

问题描述:

我试图使用http://www.androidbootstrap.com/来引导一个新的Android应用程序。它用Otto,Dagger,Butterknife,Retrofit和其他一些漂亮的东西创建了一个项目,同时还创建了如何使用它的示例代码。这非常有用,因为它设置了注释处理以及Android Studio的Gradle构建文件中的所有内容,以便轻松导入它,它非常整洁。AndroidBootstrap:身份验证 - 它是如何工作的?

但是,我在登录屏幕处于亏损状态。

/** 
    * This method gets called when the 
    * methods gets invoked. 
    * This happens on a different process, so debugging it can be a beast. 
    * 
    * @param response 
    * @param account 
    * @param authTokenType 
    * @param options 
    * @return 
    * @throws NetworkErrorException 
    */ 
    @Override 
    public Bundle getAuthToken(final AccountAuthenticatorResponse response, 
           final Account account, final String authTokenType, 
           final Bundle options) throws NetworkErrorException { 

     Ln.d("Attempting to get authToken"); 

     final String authToken = AccountManager.get(context).peekAuthToken(account, authTokenType); 

     final Bundle bundle = new Bundle(); 
     bundle.putString(KEY_ACCOUNT_NAME, account.name); 
     bundle.putString(KEY_ACCOUNT_TYPE, Constants.Auth.BOOTSTRAP_ACCOUNT_TYPE); 
     bundle.putString(KEY_AUTHTOKEN, authToken); 

     return bundle; 
    } 

    @Override 
    public String getAuthTokenLabel(final String authTokenType) { 
     return authTokenType.equals(Constants.Auth.AUTHTOKEN_TYPE) ? authTokenType : null; 
    } 

    @Override 
    public Bundle hasFeatures(final AccountAuthenticatorResponse response, final Account account, 
           final String[] features) throws NetworkErrorException { 
     final Bundle result = new Bundle(); 
     result.putBoolean(KEY_BOOLEAN_RESULT, false); 
     return result; 
    } 

    @Override 
    public Bundle updateCredentials(final AccountAuthenticatorResponse response, 
            final Account account, final String authTokenType, 
            final Bundle options) { 
     return null; 
    } 
} 

我无法验证它,实际上“登录”。

所以我的问题有以下几点:

  • 这是什么认证验证反对? Android设备帐户或Parse.com或完全不同的东西?
  • 该验证器的工作原理是什么?是否有指导说明应该如何做(如果不是Bootstrap,请注意,在AndroidBootstrap网站上,没有,视频指南已过时)?对我来说,这看起来像一个随机服务(如AccountAuthenticatorService),一个AbstractAccountAuthenticator ...巨大的混乱...虽然我确定它对某些东西有好处,但看起来不必要的过于复杂,我不明白发生了什么。

书面上https://github.com/AndroidBootstrap/android-bootstrap - 登录凭据

用户名: [email protected]

密码:的Android

它会验证你对Parse.com因为这是它被设置为一个演示。

这是使用在Android v2.0中添加的帐户验证器,并将该帐户添加到Android中的帐户

的更多信息,请访问:

http://udinic.wordpress.com/2013/04/24/write-your-own-android-authenticator/ http://www.jiahaoliuliu.com/2012/05/android-account-manager-part-i.html http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/