- private void syncAccount(){\r
- /// immediately request for the synchronization of the new account\r
- Bundle bundle = new Bundle();\r
- bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);\r
- ContentResolver.requestSync(mAccount, AccountAuthenticator.AUTHORITY, bundle);\r
+ \r
+ /**\r
+ * Asynchronous task to get the SAML User name from OCS-API\r
+ *\r
+ */\r
+ private class GetUserNameTask extends AsyncTask<Void, Void, String>{\r
+\r
+ @Override\r
+ protected String doInBackground(Void... params) {\r
+ \r
+ GetUserNameRemoteOperation getUserOperation = new GetUserNameRemoteOperation(mHostBaseUrl, mAuthToken);\r
+ WebdavClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(mHostBaseUrl), getApplicationContext(), true);\r
+ RemoteOperationResult result = getUserOperation.execute(client);\r
+ \r
+ return result.getUserName();\r
+ }\r
+ \r
+ }\r
+\r
+ /**\r
+ * Get the user name form OCS-API\r
+ * @return username\r
+ */\r
+ private String getUserNameForSaml(){\r
+\r
+ GetUserNameTask getUserTask = new GetUserNameTask();\r
+ String username = null;\r
+ try {\r
+ username = getUserTask.execute().get();\r
+ } catch (InterruptedException e) {\r
+ e.printStackTrace();\r
+ } catch (ExecutionException e) {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ return username;\r