Переглянути джерело

OAuth clean-up and refactoring

David A. Velasco 12 роки тому
батько
коміт
69d6d821ec
25 змінених файлів з 158 додано та 313 видалено
  1. 1 1
      AndroidManifest.xml
  2. 2 2
      res/layout-land/account_setup.xml
  3. 2 2
      res/layout/account_setup.xml
  4. 0 7
      res/values/oauth.xml
  5. 18 0
      res/values/oauth2_configuration.xml
  6. 1 1
      src/com/owncloud/android/AccountUtils.java
  7. 1 1
      src/com/owncloud/android/Uploader.java
  8. 13 3
      src/com/owncloud/android/authentication/AccountAuthenticator.java
  9. 1 1
      src/com/owncloud/android/authentication/AccountAuthenticatorService.java
  10. 18 196
      src/com/owncloud/android/authentication/AuthenticatorActivity.java
  11. 54 0
      src/com/owncloud/android/authentication/OAuth2Constants.java
  12. 0 58
      src/com/owncloud/android/authenticator/oauth2/OAuth2Context.java
  13. 1 1
      src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java
  14. 1 1
      src/com/owncloud/android/files/services/FileDownloader.java
  15. 2 2
      src/com/owncloud/android/files/services/FileUploader.java
  16. 1 1
      src/com/owncloud/android/network/OwnCloudClientUtils.java
  17. 34 28
      src/com/owncloud/android/operations/OAuth2GetAccessToken.java
  18. 1 1
      src/com/owncloud/android/operations/RemoteOperation.java
  19. 1 1
      src/com/owncloud/android/operations/UpdateOCVersionOperation.java
  20. 1 1
      src/com/owncloud/android/syncadapter/ContactSyncAdapter.java
  21. 1 1
      src/com/owncloud/android/syncadapter/FileSyncAdapter.java
  22. 1 1
      src/com/owncloud/android/ui/activity/AccountSelectActivity.java
  23. 1 1
      src/com/owncloud/android/ui/activity/FileDisplayActivity.java
  24. 1 1
      src/com/owncloud/android/ui/activity/LandingActivity.java
  25. 1 1
      src/com/owncloud/android/ui/fragment/FileDetailFragment.java

+ 1 - 1
AndroidManifest.xml

@@ -128,7 +128,7 @@
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.BROWSABLE" />
-                <data android:scheme="oauth-mobile-app" />
+                <data android:scheme="@string/oauth2_redirect_scheme" />
             </intent-filter>
             <intent-filter>
                 <action android:name="com.owncloud.android.workaround.accounts.CREATE" />

+ 2 - 2
res/layout-land/account_setup.xml

@@ -125,7 +125,7 @@
 	                android:layout_weight="1"
 	                android:ems="10"
                 	android:enabled="false"
-	                android:text="@string/oauth_url_endpoint_auth"
+	                android:text="@string/oauth2_url_endpoint_auth"
 	                android:singleLine="true"
 	                android:visibility="gone" >
 	
@@ -139,7 +139,7 @@
 	                android:layout_weight="1"
 	                android:ems="10"
                 	android:enabled="false"
-	                android:text="@string/oauth_url_endpoint_access"
+	                android:text="@string/oauth2_url_endpoint_access"
 	                android:singleLine="true"
 	                android:visibility="gone" >
 	

+ 2 - 2
res/layout/account_setup.xml

@@ -120,7 +120,7 @@
                 android:layout_weight="1"
                 android:ems="10"
                 android:enabled="false"
-                android:text="@string/oauth_url_endpoint_auth"
+                android:text="@string/oauth2_url_endpoint_auth"
                 android:singleLine="true"
                 android:visibility="gone" >
 
@@ -134,7 +134,7 @@
                 android:layout_weight="1"
                 android:ems="10"
                 android:enabled="false"
-	            android:text="@string/oauth_url_endpoint_access"
+	            android:text="@string/oauth2_url_endpoint_access"
                 android:singleLine="true"
                 android:visibility="gone" >
 

+ 0 - 7
res/values/oauth.xml

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <!-- string name="oauth_url_endpoint_auth">https://frko.surfnetlabs.nl/workshop/php-oauth/authorize.php</string>
-    <string name="oauth_url_endpoint_access">https://frko.surfnetlabs.nl/workshop/php-oauth/token.php</string -->
-    <string name="oauth_url_endpoint_auth">http://owncloud.tuxed.net/oauth/php-oauth/authorize.php</string>
-    <string name="oauth_url_endpoint_access">http://owncloud.tuxed.net/oauth/php-oauth/token.php</string>
-</resources>

+ 18 - 0
res/values/oauth2_configuration.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <!-- constants that must be respected by the authorization server; if changed, the app must be rebuild -->
+    <string name="oauth2_redirect_scheme">oauth-mobile-app</string>
+    <string name="oauth2_redirect_uri">oauth-mobile-app://callback</string>
+    
+    <!-- values that should be provided by ownCloud server -->
+    <string name="oauth2_url_endpoint_auth">http://owncloud.tuxed.net/oauth/php-oauth/authorize.php</string>
+    <string name="oauth2_url_endpoint_access">http://owncloud.tuxed.net/oauth/php-oauth/token.php</string>
+    <string name="oauth2_scope">grades</string>
+    <string name="oauth2_grant_type">authorization_code</string>	<!-- the only one supported right now -->
+    <string name="oauth2_response_type">code</string>				<!-- depends on oauth2_grant_type -->
+    
+    <!-- values that should be agreed between app and authorization server, but can be loaded without rebuilding the app -->
+    <string name="oauth2_client_id">oc-android-test</string>		<!-- preferable that client decides this -->
+    <string name="oauth2_client_secret"></string>					<!-- preferable that client decides this -->
+    
+</resources>

+ 1 - 1
src/com/owncloud/android/AccountUtils.java

@@ -19,7 +19,7 @@
 
 package com.owncloud.android;
 
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.utils.OwnCloudVersion;
 
 import android.accounts.Account;

+ 1 - 1
src/com/owncloud/android/Uploader.java

@@ -26,7 +26,7 @@ import java.util.List;
 import java.util.Stack;
 import java.util.Vector;
 
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.datamodel.DataStorageManager;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;

+ 13 - 3
src/com/owncloud/android/authenticator/AccountAuthenticator.java → src/com/owncloud/android/authentication/AccountAuthenticator.java

@@ -17,9 +17,8 @@
  *
  */
 
-package com.owncloud.android.authenticator;
+package com.owncloud.android.authentication;
 
-import com.owncloud.android.ui.activity.AuthenticatorActivity;
 
 import android.accounts.*;
 import android.content.Context;
@@ -27,6 +26,17 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.util.Log;
 
+
+/**
+ *  Authenticator for ownCloud accounts.
+ * 
+ *  Controller class accessed from the system AccountManager, providing integration of ownCloud accounts with the Android system.
+ * 
+ *  TODO - better separation in operations for OAuth-capable and regular ownCloud accounts.
+ *  TODO - review completeness 
+ * 
+ * @author David A. Velasco
+ */
 public class AccountAuthenticator extends AbstractAccountAuthenticator {
     /**
      * Is used by android system to assign accounts to authenticators. Should be
@@ -46,7 +56,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
     /**
      * Value under this key should handle path to webdav php script. Will be
      * removed and usage should be replaced by combining
-     * {@link com.owncloud.android.authenticator.AuthenticatorActivity.KEY_OC_BASE_URL} and
+     * {@link com.owncloud.android.authentication.AuthenticatorActivity.KEY_OC_BASE_URL} and
      * {@link com.owncloud.android.utils.OwnCloudVersion}
      * 
      * @deprecated

+ 1 - 1
src/com/owncloud/android/authenticator/AccountAuthenticatorService.java → src/com/owncloud/android/authentication/AccountAuthenticatorService.java

@@ -17,7 +17,7 @@
  *
  */
 
-package com.owncloud.android.authenticator;
+package com.owncloud.android.authentication;
 
 import android.app.Service;
 import android.content.Intent;

+ 18 - 196
src/com/owncloud/android/ui/activity/AuthenticatorActivity.java → src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -17,11 +17,9 @@
  *
  */
 
-package com.owncloud.android.ui.activity;
+package com.owncloud.android.authentication;
 
 import com.owncloud.android.AccountUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
-import com.owncloud.android.authenticator.oauth2.OAuth2Context;
 import com.owncloud.android.ui.dialog.SslValidatorDialog;
 import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;
 import com.owncloud.android.utils.OwnCloudVersion;
@@ -112,10 +110,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     private ExistenceCheckOperation mAuthCheckOperation;
     private RemoteOperationResult mLastSslUntrustedServerResult;
 
-    //private Thread mOAuth2GetCodeThread;
-    //private OAuth2GetAuthorizationToken mOAuth2GetCodeRunnable;     
-    //private TokenReceiver tokenReceiver;
-    //private JSONObject mCodeResponseJson; 
     private Uri mNewCapturedUriFromOAuth2Redirection;
     
     private AccountManager mAccountMgr;
@@ -173,7 +167,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         
         /// initialization
         mAccountMgr = AccountManager.get(this);
-        mNewCapturedUriFromOAuth2Redirection = null;    // TODO save?
+        mNewCapturedUriFromOAuth2Redirection = null;
         mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); 
         mAccount = null;
 
@@ -251,11 +245,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         outState.putInt(KEY_OAUTH2_STATUS_ICON, mOAuth2StatusIcon);
         outState.putInt(KEY_OAUTH2_STATUS_TEXT, mOAuth2StatusText);
         
-        /* Leave old OAuth flow
-        if (codeResponseJson != null){
-            outState.putString(KEY_OAUTH2_CODE_RESULT, codeResponseJson.toString());
-        }
-        */
     }
 
 
@@ -293,19 +282,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         // state of oAuth2 components
         mOAuth2StatusIcon = savedInstanceState.getInt(KEY_OAUTH2_STATUS_ICON);
         mOAuth2StatusText = savedInstanceState.getInt(KEY_OAUTH2_STATUS_TEXT);
-        
-        /* Leave old OAuth flow
-        // We store a JSon object with all the data returned from oAuth2 server when we get user_code.
-        // Is better than store variable by variable. We use String object to serialize from/to it.
-           try {
-            if (savedInstanceState.containsKey(KEY_OAUTH2_CODE_RESULT)) {
-                codeResponseJson = new JSONObject(savedInstanceState.getString(KEY_OAUTH2_CODE_RESULT));
-            }
-        } catch (JSONException e) {
-            Log.e(TAG, "onCreate->JSONException: " + e.toString());
-        }*/
         // END of getting the state of oAuth2 components.
-        
     }
 
     
@@ -320,7 +297,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     protected void onNewIntent (Intent intent) {
         Log.d(TAG, "onNewIntent()");
         Uri data = intent.getData();
-        if (data != null && data.toString().startsWith(OAuth2Context.MY_REDIRECT_URI)) {
+        if (data != null && data.toString().startsWith(getString(R.string.oauth2_redirect_uri))) {
             mNewCapturedUriFromOAuth2Redirection = data;
         }
     }
@@ -341,16 +318,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             else
                 Toast.makeText(this, R.string.auth_expired_basic_auth_toast, Toast.LENGTH_LONG).show();
         }
-           
         
-        /* LEAVE OLD OAUTH FLOW ; 
-        // (old oauth code) Registering token receiver. We must listening to the service that is pooling to the oAuth server for a token.
-        if (tokenReceiver == null) {
-            IntentFilter tokenFilter = new IntentFilter(OAuth2GetTokenService.TOKEN_RECEIVED_MESSAGE);                
-            tokenReceiver = new TokenReceiver();
-            this.registerReceiver(tokenReceiver,tokenFilter);
-        } */
-        // (new oauth code)
         if (mNewCapturedUriFromOAuth2Redirection != null) {
             getOAuth2AccessTokenFromCapturedRedirection();            
         }
@@ -359,23 +327,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
     }
     
     
-    @Override protected void onDestroy() {       
-        super.onDestroy();
-
-        /* LEAVE OLD OAUTH FLOW
-        // We must stop the service thats it's pooling to oAuth2 server for a token.
-        Intent tokenService = new Intent(this, OAuth2GetTokenService.class);
-        stopService(tokenService);
-        
-        // We stop listening the result of the pooling service.
-        if (tokenReceiver != null) {
-            unregisterReceiver(tokenReceiver);
-            tokenReceiver = null;
-        }*/
-
-    }    
-    
-    
     /**
      * Parses the redirection with the response to the GET AUTHORIZATION request to the 
      * oAuth server and requests for the access token (GET ACCESS TOKEN)
@@ -389,8 +340,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         showDialog(DIALOG_OAUTH2_LOGIN_PROGRESS);
 
         /// GET ACCESS TOKEN to the oAuth server 
-        RemoteOperation operation = new OAuth2GetAccessToken(queryParameters);
-        WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(getString(R.string.oauth_url_endpoint_access)), getApplicationContext());
+        RemoteOperation operation = new OAuth2GetAccessToken(   getString(R.string.oauth2_client_id), 
+                                                                getString(R.string.oauth2_redirect_uri), // TODO check - necessary here?      
+                                                                getString(R.string.oauth2_grant_type),
+                                                                queryParameters);
+        WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(getString(R.string.oauth2_url_endpoint_access)), getApplicationContext());
         operation.execute(client, this, mHandler);
     }
     
@@ -488,7 +442,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * @param view      Cancel button
      */
     public void onCancelClick(View view) {
-        setResult(RESULT_CANCELED);     // TODO review how is this related to AccountAuthenticator
+        setResult(RESULT_CANCELED);     // TODO review how is this related to AccountAuthenticator (debugging)
         finish();
     }
     
@@ -562,26 +516,17 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         updateAuthStatus();
         
         // GET AUTHORIZATION request
-        /*
-        mOAuth2GetCodeRunnable = new OAuth2GetAuthorizationToken(, this);
-        mOAuth2GetCodeRunnable.setListener(this, mHandler);
-        mOAuth2GetCodeThread = new Thread(mOAuth2GetCodeRunnable);
-        mOAuth2GetCodeThread.start();
-        */
-        
-        //if (mGrantType.equals(OAuth2Context.OAUTH2_AUTH_CODE_GRANT_TYPE)) {
-        Uri uri = Uri.parse(getString(R.string.oauth_url_endpoint_auth));
+        Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth));
         Uri.Builder uriBuilder = uri.buildUpon();
-        uriBuilder.appendQueryParameter(OAuth2Context.CODE_RESPONSE_TYPE, OAuth2Context.OAUTH2_CODE_RESPONSE_TYPE);
-        uriBuilder.appendQueryParameter(OAuth2Context.CODE_REDIRECT_URI, OAuth2Context.MY_REDIRECT_URI);   
-        uriBuilder.appendQueryParameter(OAuth2Context.CODE_CLIENT_ID, OAuth2Context.OAUTH2_F_CLIENT_ID);
-        uriBuilder.appendQueryParameter(OAuth2Context.CODE_SCOPE, OAuth2Context.OAUTH2_F_SCOPE);
-        //uriBuilder.appendQueryParameter(OAuth2Context.CODE_STATE, whateverwewant);
+        uriBuilder.appendQueryParameter(OAuth2Constants.KEY_RESPONSE_TYPE, getString(R.string.oauth2_response_type));
+        uriBuilder.appendQueryParameter(OAuth2Constants.KEY_REDIRECT_URI, getString(R.string.oauth2_redirect_uri));   
+        uriBuilder.appendQueryParameter(OAuth2Constants.KEY_CLIENT_ID, getString(R.string.oauth2_client_id));
+        uriBuilder.appendQueryParameter(OAuth2Constants.KEY_SCOPE, getString(R.string.oauth2_scope));
+        //uriBuilder.appendQueryParameter(OAuth2Constants.KEY_STATE, whateverwewant);
         uri = uriBuilder.build();
         Log.d(TAG, "Starting browser to view " + uri.toString());
         Intent i = new Intent(Intent.ACTION_VIEW, uri);
         startActivity(i);
-        //}
     }
 
     
@@ -767,7 +712,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             showDialog(DIALOG_LOGIN_PROGRESS);
             
             /// time to test the retrieved access token on the ownCloud server
-            mOAuthAccessToken = ((OAuth2GetAccessToken)operation).getResultTokenMap().get(OAuth2Context.KEY_ACCESS_TOKEN);
+            mOAuthAccessToken = ((OAuth2GetAccessToken)operation).getResultTokenMap().get(OAuth2Constants.KEY_ACCESS_TOKEN);
             Log.d(TAG, "Got ACCESS TOKEN: " + mOAuthAccessToken);
             mAuthCheckOperation = new ExistenceCheckOperation("", this, false);
             WebdavClient client = OwnCloudClientUtils.createOwnCloudClient(Uri.parse(mHostBaseUrl + webdav_path), this);
@@ -844,9 +789,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * This makes the account permanent.
      * 
      * TODO Decide how to name the OAuth accounts
-     * TODO Minimize the direct interactions with the account manager; seems that not all the operations 
-     * in the current code are really necessary, provided that right extras are returned to the Account
-     * Authenticator through setAccountAuthenticatorResult  
      */
     private void createAccount() {
         /// create and save new ownCloud account
@@ -855,7 +797,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
         Uri uri = Uri.parse(mHostBaseUrl);
         String username = mUsernameInput.getText().toString().trim();
         if (isOAuth) {
-            username = "OAuth_user" + (new java.util.Random(System.currentTimeMillis())).nextLong();    // TODO change this to something readable
+            username = "OAuth_user" + (new java.util.Random(System.currentTimeMillis())).nextLong();
         }            
         String accountName = username + "@" + uri.getHost();
         if (uri.getPort() >= 0) {
@@ -957,21 +899,8 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
             break;
         }
         case DIALOG_OAUTH2_LOGIN_PROGRESS: {
-            /// oAuth2 dialog. We show here to the user the URL and user_code that the user must validate in a web browser. - OLD!
-            // TODO optimize this dialog
             ProgressDialog working_dialog = new ProgressDialog(this);
-            /* Leave the old OAuth flow
-            try {
-                if (mCodeResponseJson != null && mCodeResponseJson.has(OAuth2GetCodeRunnable.CODE_VERIFICATION_URL)) {
-                    working_dialog.setMessage(String.format(getString(R.string.oauth_code_validation_message), 
-                            mCodeResponseJson.getString(OAuth2GetCodeRunnable.CODE_VERIFICATION_URL), 
-                            mCodeResponseJson.getString(OAuth2GetCodeRunnable.CODE_USER_CODE)));
-                } else {*/
-                    working_dialog.setMessage(String.format("Getting authorization")); 
-                /*}
-            } catch (JSONException e) {
-                Log.e(TAG, "onCreateDialog->JSONException: " + e.toString());
-            }*/
+            working_dialog.setMessage(String.format("Getting authorization")); 
             working_dialog.setIndeterminate(true);
             working_dialog.setCancelable(true);
             working_dialog
@@ -979,15 +908,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
                 @Override
                 public void onCancel(DialogInterface dialog) {
                     Log.i(TAG, "Login canceled");
-                    /*if (mOAuth2GetCodeThread != null) {
-                        mOAuth2GetCodeThread.interrupt();
-                        finish();
-                    } */
-                    /*if (tokenReceiver != null) {
-                        unregisterReceiver(tokenReceiver);
-                        tokenReceiver = null;
-                        finish();
-                    }*/
                     finish();
                 }
             });
@@ -1056,20 +976,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
      * to the interactions with the OAuth authorization server.
      */
     private void updateAuthStatus() {
-        /*ImageView iv = (ImageView) findViewById(R.id.auth_status_icon);
-        TextView tv = (TextView) findViewById(R.id.auth_status_text);*/
-
         if (mStatusIcon == 0 && mStatusText == 0) {
             mAuthStatusLayout.setVisibility(View.INVISIBLE);
-            /*iv.setVisibility(View.INVISIBLE);
-            tv.setVisibility(View.INVISIBLE);*/
         } else {
             mAuthStatusLayout.setText(mStatusText);
             mAuthStatusLayout.setCompoundDrawablesWithIntrinsicBounds(mStatusIcon, 0, 0, 0);
-            /*iv.setImageResource(mStatusIcon);
-            tv.setText(mStatusText);
-            /*iv.setVisibility(View.VISIBLE);
-            tv.setVisibility(View.VISIBLE);^*/
             mAuthStatusLayout.setVisibility(View.VISIBLE);
         }
     }     
@@ -1147,95 +1058,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
 
     }    
     
-    /* Leave the old OAuth flow
-    // Results from the first call to oAuth2 server : getting the user_code and verification_url.
-    @Override
-    public void onOAuth2GetCodeResult(ResultOAuthType type, JSONObject responseJson) {
-        if ((type == ResultOAuthType.OK_SSL)||(type == ResultOAuthType.OK_NO_SSL)) {
-            mCodeResponseJson = responseJson;
-            if (mCodeResponseJson != null) {
-                getOAuth2AccessTokenFromJsonResponse();
-            }  // else - nothing to do here - wait for callback !!!
-        
-        } else if (type == ResultOAuthType.HOST_NOT_AVAILABLE) {
-            updateOAuth2IconAndText(R.drawable.common_error, R.string.oauth_connection_url_unavailable);
-        }
-    }
-
-    // If the results of getting the user_code and verification_url are OK, we get the received data and we start
-    // the polling service to oAuth2 server to get a valid token.
-    private void getOAuth2AccessTokenFromJsonResponse() {
-        String deviceCode = null;
-        String verificationUrl = null;
-        String userCode = null;
-        int expiresIn = -1;
-        int interval = -1;
-
-        Log.d(TAG, "ResponseOAuth2->" + mCodeResponseJson.toString());
-
-        try {
-            // We get data that we must show to the user or we will use internally.
-            verificationUrl = mCodeResponseJson.getString(OAuth2GetAuthorizationToken.CODE_VERIFICATION_URL);
-            userCode = mCodeResponseJson.getString(OAuth2GetAuthorizationToken.CODE_USER_CODE);
-            expiresIn = mCodeResponseJson.getInt(OAuth2GetAuthorizationToken.CODE_EXPIRES_IN);                
-
-            // And we get data that we must use to get a token.
-            deviceCode = mCodeResponseJson.getString(OAuth2GetAuthorizationToken.CODE_DEVICE_CODE);
-            interval = mCodeResponseJson.getInt(OAuth2GetAuthorizationToken.CODE_INTERVAL);
-
-        } catch (JSONException e) {
-            Log.e(TAG, "Exception accesing data in Json object" + e.toString());
-        }
-
-        // Updating status widget to OK.
-        updateOAuth2IconAndText(R.drawable.ic_ok, R.string.auth_connection_established);
-        
-        // Showing the dialog with instructions for the user.
-        showDialog(DIALOG_OAUTH2_LOGIN_PROGRESS);
-
-        // Loggin all the data.
-        Log.d(TAG, "verificationUrl->" + verificationUrl);
-        Log.d(TAG, "userCode->" + userCode);
-        Log.d(TAG, "deviceCode->" + deviceCode);
-        Log.d(TAG, "expiresIn->" + expiresIn);
-        Log.d(TAG, "interval->" + interval);
-
-        // Starting the pooling service.
-        try {
-            Intent tokenService = new Intent(this, OAuth2GetTokenService.class);
-            tokenService.putExtra(OAuth2GetTokenService.TOKEN_URI, OAuth2Context.OAUTH2_G_DEVICE_GETTOKEN_URL);
-            tokenService.putExtra(OAuth2GetTokenService.TOKEN_DEVICE_CODE, deviceCode);
-            tokenService.putExtra(OAuth2GetTokenService.TOKEN_INTERVAL, interval);
-
-            startService(tokenService);
-        }
-        catch (Exception e) {
-            Log.e(TAG, "tokenService creation problem :", e);
-        }
-        
-    }   
-    */
-    
-    /* Leave the old OAuth flow
-    // We get data from the oAuth2 token service with this broadcast receiver.
-    private class TokenReceiver extends BroadcastReceiver {
-        /**
-         * The token is received.
-         *  @author
-         * {@link BroadcastReceiver} to enable oAuth2 token receiving.
-         *-/
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            @SuppressWarnings("unchecked")
-            HashMap<String, String> tokenResponse = (HashMap<String, String>)intent.getExtras().get(OAuth2GetTokenService.TOKEN_RECEIVED_DATA);
-            Log.d(TAG, "TokenReceiver->" + tokenResponse.get(OAuth2GetTokenService.TOKEN_ACCESS_TOKEN));
-            dismissDialog(DIALOG_OAUTH2_LOGIN_PROGRESS);
-
-        }
-    }
-    */
-
-    
     /**
      * Called from SslValidatorDialog when a new server certificate was correctly saved.
      */

+ 54 - 0
src/com/owncloud/android/authentication/OAuth2Constants.java

@@ -0,0 +1,54 @@
+/* ownCloud Android client application
+ *   Copyright (C) 2012-2013 ownCloud Inc.
+ *
+ *   This program is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package com.owncloud.android.authentication;
+
+/** 
+ * Constant values for OAuth 2 protocol.
+ * 
+ * Includes required and optional parameter NAMES used in the 'authorization code' grant type.
+ *  
+ * @author David A. Velasco
+ */
+
+public class OAuth2Constants {
+    
+    /// Parameters to send to the Authorization Endpoint
+    public static final String KEY_RESPONSE_TYPE = "response_type";
+    public static final String KEY_REDIRECT_URI = "redirect_uri";
+    public static final String KEY_CLIENT_ID = "client_id";
+    public static final String KEY_SCOPE = "scope";
+    public static final String KEY_STATE = "state"; 
+    
+    /// Additional parameters to send to the Token Endpoint
+    public static final String KEY_GRANT_TYPE = "grant_type";
+    public static final String KEY_CODE = "code";
+    
+    /// Parameters received in an OK response from the Token Endpoint 
+    public static final String KEY_ACCESS_TOKEN = "access_token";
+    public static final String KEY_TOKEN_TYPE = "token_type";
+    public static final String KEY_EXPIRES_IN = "expires_in";
+    public static final String KEY_REFRESH_TOKEN = "refresh_token";
+    
+    /// Parameters in an ERROR response
+    public static final String KEY_ERROR = "error";
+    public static final String KEY_ERROR_DESCRIPTION = "error_description";
+    public static final String KEY_ERROR_URI = "error_uri";
+    public static final String VALUE_ERROR_ACCESS_DENIED = "access_denied";
+    
+}

+ 0 - 58
src/com/owncloud/android/authenticator/oauth2/OAuth2Context.java

@@ -1,58 +0,0 @@
-package com.owncloud.android.authenticator.oauth2;
-
-/** 
- *  Class used to store data from the app registration in oAuth2 server.
- *  THIS VALUES ARE ORIENTATIVE.
- *  MUST BE CHANGED WITH THE CORRECT ONES.
- *  
- * @author SolidGear S.L.
- *
- */
-
-public class OAuth2Context {
-    
-    public static final String OAUTH2_G_DEVICE_CLIENT_ID = "1044165972576.apps.googleusercontent.com";  
-    public static final String OAUTH2_G_DEVICE_CLIENT_SECRET = "rwrA86fnIRCC3bZm0tWnKOkV";
-    public static final String OAUTH_G_DEVICE_GETTOKEN_GRANT_TYPE = "http://oauth.net/grant_type/device/1.0";
-    public static final String OAUTH2_G_DEVICE_GETCODE_URL = "https://accounts.google.com/o/oauth2/device/code";  
-    public static final String OAUTH2_G_DEVICE_GETTOKEN_URL = "https://accounts.google.com/o/oauth2/token";
-    public static final String OAUTH2_G_DEVICE_GETCODE_SCOPES = "https://www.googleapis.com/auth/userinfo.email";
-    
-    //public static final String OAUTH2_F_AUTHORIZATION_ENDPOINT_URL = "https://frko.surfnetlabs.nl/workshop/php-oauth/authorize.php";
-    //public static final String OAUTH2_F_TOKEN_ENDPOINT_URL = "https://frko.surfnetlabs.nl/workshop/php-oauth/token.php";
-    public static final String OAUTH2_F_CLIENT_ID = "oc-android-test";
-    public static final String OAUTH2_F_SCOPE = "grades";
-    
-    public static final String OAUTH2_AUTH_CODE_GRANT_TYPE = "authorization_code";
-    public static final String OAUTH2_CODE_RESPONSE_TYPE = "code";
-
-    public static final String OAUTH2_TOKEN_RECEIVED_ERROR = "error";
-
-    public static final String MY_REDIRECT_URI = "oauth-mobile-app://callback";   // THIS CAN'T BE READ DYNAMICALLY; MUST BE DEFINED IN INSTALLATION TIME
-    
-    public static final String KEY_ACCESS_TOKEN = "access_token";
-    public static final String KEY_TOKEN_TYPE = "token_type";
-    public static final String KEY_EXPIRES_IN = "expires_in";
-    public static final String KEY_REFRESH_TOKEN = "refresh_token";
-    public static final String KEY_SCOPE = "scope";
-    public static final String KEY_ERROR = "error";
-    public static final String KEY_ERROR_DESCRIPTION = "error_description";
-    public static final String KEY_ERROR_URI = "error_uri";
-    public static final String KEY_REDIRECT_URI = "redirect_uri";
-    public static final String KEY_GRANT_TYPE = "grant_type";
-    public static final String KEY_CODE = "code";
-    public static final String KEY_CLIENT_ID = "client_id";
-    
-    public static final String CODE_USER_CODE  =  "user_code";
-    public static final String CODE_CLIENT_ID  =  "client_id";
-    public static final String CODE_SCOPE  =  "scope";    
-    public static final String CODE_VERIFICATION_URL  =  "verification_url";
-    public static final String CODE_EXPIRES_IN  =  "expires_in";
-    public static final String CODE_DEVICE_CODE = "device_code";
-    public static final String CODE_INTERVAL = "interval";
-    public static final String CODE_RESPONSE_TYPE = "response_type";
-    public static final String CODE_REDIRECT_URI = "redirect_uri";
-    
-    public static final String ERROR_ACCESS_DENIED = "access_denied";
-    
-}

+ 1 - 1
src/com/owncloud/android/files/InstantUploadBroadcastReceiver.java

@@ -22,7 +22,7 @@ package com.owncloud.android.files;
 import java.io.File;
 
 import com.owncloud.android.AccountUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.db.DbHandler;
 import com.owncloud.android.files.services.FileUploader;
 

+ 1 - 1
src/com/owncloud/android/files/services/FileDownloader.java

@@ -27,6 +27,7 @@ import java.util.Vector;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import eu.alefzero.webdav.OnDatatransferProgressListener;
@@ -35,7 +36,6 @@ import com.owncloud.android.network.OwnCloudClientUtils;
 import com.owncloud.android.operations.DownloadFileOperation;
 import com.owncloud.android.operations.RemoteOperationResult;
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.ui.activity.AuthenticatorActivity;
 import com.owncloud.android.ui.activity.FileDetailActivity;
 import com.owncloud.android.ui.fragment.FileDetailFragment;
 

+ 2 - 2
src/com/owncloud/android/files/services/FileUploader.java

@@ -31,7 +31,8 @@ import org.apache.http.HttpStatus;
 import org.apache.jackrabbit.webdav.MultiStatus;
 import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
 
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
+import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.InstantUploadBroadcastReceiver;
@@ -41,7 +42,6 @@ import com.owncloud.android.operations.RemoteOperation;
 import com.owncloud.android.operations.RemoteOperationResult;
 import com.owncloud.android.operations.UploadFileOperation;
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.ui.activity.AuthenticatorActivity;
 import com.owncloud.android.ui.activity.FileDetailActivity;
 import com.owncloud.android.ui.fragment.FileDetailFragment;
 import com.owncloud.android.utils.OwnCloudVersion;

+ 1 - 1
src/com/owncloud/android/network/OwnCloudClientUtils.java

@@ -38,7 +38,7 @@ import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier;
 import org.apache.http.conn.ssl.X509HostnameVerifier;
 
 import com.owncloud.android.AccountUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 
 import eu.alefzero.webdav.WebdavClient;
 

+ 34 - 28
src/com/owncloud/android/operations/OAuth2GetAccessToken.java

@@ -8,7 +8,7 @@ import org.apache.commons.httpclient.NameValuePair;
 import org.json.JSONException;
 import org.json.JSONObject;
 
-import com.owncloud.android.authenticator.oauth2.OAuth2Context;
+import com.owncloud.android.authentication.OAuth2Constants;
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
 
 import android.util.Log;
@@ -19,13 +19,19 @@ public class OAuth2GetAccessToken extends RemoteOperation {
     
     private static final String TAG = OAuth2GetAccessToken.class.getSimpleName();
     
+    private String mClientId;
+    private String mRedirectUri;
+    private String mGrantType;
+    
     private String mOAuth2AuthorizationResponse;
     private Map<String, String> mOAuth2ParsedAuthorizationResponse;
     private Map<String, String> mResultTokenMap;
 
     
-    public OAuth2GetAccessToken(String oAuth2AuthorizationResponse) {
-        
+    public OAuth2GetAccessToken(String clientId, String redirectUri, String grantType, String oAuth2AuthorizationResponse) {
+        mClientId = clientId;
+        mRedirectUri = redirectUri;
+        mGrantType = grantType;
         mOAuth2AuthorizationResponse = oAuth2AuthorizationResponse;
         mOAuth2ParsedAuthorizationResponse = new HashMap<String, String>();
         mResultTokenMap = null;
@@ -47,8 +53,8 @@ public class OAuth2GetAccessToken extends RemoteOperation {
         
         try {
             parseAuthorizationResponse();
-            if (mOAuth2ParsedAuthorizationResponse.keySet().contains(OAuth2Context.KEY_ERROR)) {
-                if (OAuth2Context.ERROR_ACCESS_DENIED.equals(mOAuth2ParsedAuthorizationResponse.get(OAuth2Context.KEY_ERROR))) {
+            if (mOAuth2ParsedAuthorizationResponse.keySet().contains(OAuth2Constants.KEY_ERROR)) {
+                if (OAuth2Constants.VALUE_ERROR_ACCESS_DENIED.equals(mOAuth2ParsedAuthorizationResponse.get(OAuth2Constants.KEY_ERROR))) {
                     result = new RemoteOperationResult(ResultCode.OAUTH2_ERROR_ACCESS_DENIED);
                 } else {
                     result = new RemoteOperationResult(ResultCode.OAUTH2_ERROR);
@@ -57,11 +63,11 @@ public class OAuth2GetAccessToken extends RemoteOperation {
             
             if (result == null) { 
                 NameValuePair[] nameValuePairs = new NameValuePair[5];
-                nameValuePairs[0] = new NameValuePair(OAuth2Context.KEY_CLIENT_ID, OAuth2Context.OAUTH2_F_CLIENT_ID);
-                nameValuePairs[1] = new NameValuePair(OAuth2Context.KEY_CODE, mOAuth2ParsedAuthorizationResponse.get(OAuth2Context.KEY_CODE));            
-                nameValuePairs[2] = new NameValuePair(OAuth2Context.KEY_SCOPE, mOAuth2ParsedAuthorizationResponse.get(OAuth2Context.KEY_SCOPE));            
-                nameValuePairs[3] = new NameValuePair(OAuth2Context.KEY_REDIRECT_URI, OAuth2Context.MY_REDIRECT_URI);            
-                nameValuePairs[4] = new NameValuePair(OAuth2Context.KEY_GRANT_TYPE, OAuth2Context.OAUTH2_AUTH_CODE_GRANT_TYPE);
+                nameValuePairs[0] = new NameValuePair(OAuth2Constants.KEY_GRANT_TYPE, mGrantType);
+                nameValuePairs[1] = new NameValuePair(OAuth2Constants.KEY_CODE, mOAuth2ParsedAuthorizationResponse.get(OAuth2Constants.KEY_CODE));            
+                nameValuePairs[2] = new NameValuePair(OAuth2Constants.KEY_REDIRECT_URI, mRedirectUri);       
+                nameValuePairs[3] = new NameValuePair(OAuth2Constants.KEY_CLIENT_ID, mClientId);
+                //nameValuePairs[4] = new NameValuePair(OAuth2Constants.KEY_SCOPE, mOAuth2ParsedAuthorizationResponse.get(OAuth2Constants.KEY_SCOPE));         
                 
                 postMethod = new PostMethod(client.getBaseUri().toString());
                 postMethod.setRequestBody(nameValuePairs);
@@ -71,7 +77,7 @@ public class OAuth2GetAccessToken extends RemoteOperation {
                 if (response != null && response.length() > 0) {
                     JSONObject tokenJson = new JSONObject(response);
                     parseAccessTokenResult(tokenJson);
-                    if (mResultTokenMap.get(OAuth2Context.OAUTH2_TOKEN_RECEIVED_ERROR) != null || mResultTokenMap.get(OAuth2Context.KEY_ACCESS_TOKEN) == null) {
+                    if (mResultTokenMap.get(OAuth2Constants.KEY_ERROR) != null || mResultTokenMap.get(OAuth2Constants.KEY_ACCESS_TOKEN) == null) {
                         result = new RemoteOperationResult(ResultCode.OAUTH2_ERROR);
                     
                     } else {
@@ -98,7 +104,7 @@ public class OAuth2GetAccessToken extends RemoteOperation {
                 Log.e(TAG, "OAuth2 TOKEN REQUEST with auth code " + mOAuth2ParsedAuthorizationResponse.get("code") + " to " + client.getBaseUri() + ": " + result.getLogMessage(), result.getException());
                 
             } else if (result.getCode() == ResultCode.OAUTH2_ERROR) {
-                    Log.e(TAG, "OAuth2 TOKEN REQUEST with auth code " + mOAuth2ParsedAuthorizationResponse.get("code") + " to " + client.getBaseUri() + ": " + ((mResultTokenMap != null) ? mResultTokenMap.get(OAuth2Context.OAUTH2_TOKEN_RECEIVED_ERROR) : "NULL"));
+                    Log.e(TAG, "OAuth2 TOKEN REQUEST with auth code " + mOAuth2ParsedAuthorizationResponse.get("code") + " to " + client.getBaseUri() + ": " + ((mResultTokenMap != null) ? mResultTokenMap.get(OAuth2Constants.KEY_ERROR) : "NULL"));
                     
             } else {
                 Log.e(TAG, "OAuth2 TOKEN REQUEST with auth code " + mOAuth2ParsedAuthorizationResponse.get("code") + " to " + client.getBaseUri() + ": " + result.getLogMessage());
@@ -140,29 +146,29 @@ public class OAuth2GetAccessToken extends RemoteOperation {
     private void parseAccessTokenResult (JSONObject tokenJson) throws JSONException {
         mResultTokenMap = new HashMap<String, String>();
         
-        if (tokenJson.has(OAuth2Context.KEY_ACCESS_TOKEN)) {
-            mResultTokenMap.put(OAuth2Context.KEY_ACCESS_TOKEN, tokenJson.getString(OAuth2Context.KEY_ACCESS_TOKEN));
+        if (tokenJson.has(OAuth2Constants.KEY_ACCESS_TOKEN)) {
+            mResultTokenMap.put(OAuth2Constants.KEY_ACCESS_TOKEN, tokenJson.getString(OAuth2Constants.KEY_ACCESS_TOKEN));
         }
-        if (tokenJson.has(OAuth2Context.KEY_TOKEN_TYPE)) {
-            mResultTokenMap.put(OAuth2Context.KEY_TOKEN_TYPE, tokenJson.getString(OAuth2Context.KEY_TOKEN_TYPE));
+        if (tokenJson.has(OAuth2Constants.KEY_TOKEN_TYPE)) {
+            mResultTokenMap.put(OAuth2Constants.KEY_TOKEN_TYPE, tokenJson.getString(OAuth2Constants.KEY_TOKEN_TYPE));
         }
-        if (tokenJson.has(OAuth2Context.KEY_EXPIRES_IN)) {
-            mResultTokenMap.put(OAuth2Context.KEY_EXPIRES_IN, tokenJson.getString(OAuth2Context.KEY_EXPIRES_IN));
+        if (tokenJson.has(OAuth2Constants.KEY_EXPIRES_IN)) {
+            mResultTokenMap.put(OAuth2Constants.KEY_EXPIRES_IN, tokenJson.getString(OAuth2Constants.KEY_EXPIRES_IN));
         }
-        if (tokenJson.has(OAuth2Context.KEY_REFRESH_TOKEN)) {
-            mResultTokenMap.put(OAuth2Context.KEY_REFRESH_TOKEN, tokenJson.getString(OAuth2Context.KEY_REFRESH_TOKEN));
+        if (tokenJson.has(OAuth2Constants.KEY_REFRESH_TOKEN)) {
+            mResultTokenMap.put(OAuth2Constants.KEY_REFRESH_TOKEN, tokenJson.getString(OAuth2Constants.KEY_REFRESH_TOKEN));
         }
-        if (tokenJson.has(OAuth2Context.KEY_SCOPE)) {
-            mResultTokenMap.put(OAuth2Context.KEY_SCOPE, tokenJson.getString(OAuth2Context.KEY_SCOPE));
+        if (tokenJson.has(OAuth2Constants.KEY_SCOPE)) {
+            mResultTokenMap.put(OAuth2Constants.KEY_SCOPE, tokenJson.getString(OAuth2Constants.KEY_SCOPE));
         }
-        if (tokenJson.has(OAuth2Context.KEY_ERROR)) {
-            mResultTokenMap.put(OAuth2Context.KEY_ERROR, tokenJson.getString(OAuth2Context.KEY_ERROR));
+        if (tokenJson.has(OAuth2Constants.KEY_ERROR)) {
+            mResultTokenMap.put(OAuth2Constants.KEY_ERROR, tokenJson.getString(OAuth2Constants.KEY_ERROR));
         }
-        if (tokenJson.has(OAuth2Context.KEY_ERROR_DESCRIPTION)) {
-            mResultTokenMap.put(OAuth2Context.KEY_ERROR_DESCRIPTION, tokenJson.getString(OAuth2Context.KEY_ERROR_DESCRIPTION));
+        if (tokenJson.has(OAuth2Constants.KEY_ERROR_DESCRIPTION)) {
+            mResultTokenMap.put(OAuth2Constants.KEY_ERROR_DESCRIPTION, tokenJson.getString(OAuth2Constants.KEY_ERROR_DESCRIPTION));
         }
-        if (tokenJson.has(OAuth2Context.KEY_ERROR_URI)) {
-            mResultTokenMap.put(OAuth2Context.KEY_ERROR_URI, tokenJson.getString(OAuth2Context.KEY_ERROR_URI));
+        if (tokenJson.has(OAuth2Constants.KEY_ERROR_URI)) {
+            mResultTokenMap.put(OAuth2Constants.KEY_ERROR_URI, tokenJson.getString(OAuth2Constants.KEY_ERROR_URI));
         }
     }
 

+ 1 - 1
src/com/owncloud/android/operations/RemoteOperation.java

@@ -21,7 +21,7 @@ import java.io.IOException;
 
 import org.apache.commons.httpclient.Credentials;
 
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.network.BearerCredentials;
 import com.owncloud.android.network.OwnCloudClientUtils;
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;

+ 1 - 1
src/com/owncloud/android/operations/UpdateOCVersionOperation.java

@@ -29,7 +29,7 @@ import android.content.Context;
 import android.util.Log;
 
 import com.owncloud.android.AccountUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
 import com.owncloud.android.utils.OwnCloudVersion;
 

+ 1 - 1
src/com/owncloud/android/syncadapter/ContactSyncAdapter.java

@@ -26,7 +26,7 @@ import org.apache.http.client.methods.HttpPut;
 import org.apache.http.entity.ByteArrayEntity;
 
 import com.owncloud.android.AccountUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 
 import android.accounts.Account;
 import android.accounts.AccountManager;

+ 1 - 1
src/com/owncloud/android/syncadapter/FileSyncAdapter.java

@@ -28,6 +28,7 @@ import java.util.Map;
 import org.apache.jackrabbit.webdav.DavException;
 
 import com.owncloud.android.R;
+import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.datamodel.DataStorageManager;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
@@ -35,7 +36,6 @@ import com.owncloud.android.operations.RemoteOperationResult;
 import com.owncloud.android.operations.SynchronizeFolderOperation;
 import com.owncloud.android.operations.UpdateOCVersionOperation;
 import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
-import com.owncloud.android.ui.activity.AuthenticatorActivity;
 import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
 
 import android.accounts.Account;

+ 1 - 1
src/com/owncloud/android/ui/activity/AccountSelectActivity.java

@@ -50,7 +50,7 @@ import com.actionbarsherlock.view.Menu;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 import com.owncloud.android.AccountUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 
 import com.owncloud.android.R;
 

+ 1 - 1
src/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -66,7 +66,7 @@ import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 import com.actionbarsherlock.view.Window;
 import com.owncloud.android.AccountUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.datamodel.DataStorageManager;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;

+ 1 - 1
src/com/owncloud/android/ui/activity/LandingActivity.java

@@ -18,7 +18,7 @@
 package com.owncloud.android.ui.activity;
 
 import com.actionbarsherlock.app.SherlockFragmentActivity;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.ui.adapter.LandingScreenAdapter;
 
 import android.accounts.Account;

+ 1 - 1
src/com/owncloud/android/ui/fragment/FileDetailFragment.java

@@ -56,7 +56,7 @@ import android.widget.Toast;
 
 import com.actionbarsherlock.app.SherlockFragment;
 import com.owncloud.android.DisplayUtils;
-import com.owncloud.android.authenticator.AccountAuthenticator;
+import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
 import com.owncloud.android.files.services.FileDownloader;