+ \r
+ \r
+ /**\r
+ * Asynchronous task to get the SAML User name from OCS-API\r
+ *\r
+ */\r
+ private class GetUserNameTask extends AsyncTask<String, Void, String>{\r
+\r
+ @Override\r
+ protected String doInBackground(String... params) {\r
+ \r
+ String hostUrl = (String)params[0];\r
+ \r
+ GetUserNameRemoteOperation getUserOperation = new GetUserNameRemoteOperation(hostUrl, mAuthToken);\r
+ WebdavClient client = OwnCloudClientFactory.createOwnCloudClient(Uri.parse(hostUrl), 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
+ * @param hostUrl\r
+ * @return username\r
+ */\r
+ private String getUserNameForSaml(String hostUrl){\r
+\r
+ GetUserNameTask getUserTask = new GetUserNameTask();\r
+ String username = null;\r
+ try {\r
+ username = getUserTask.execute(mHostBaseUrl).get();\r
+ } catch (InterruptedException e) {\r
+ e.printStackTrace();\r
+ } catch (ExecutionException e) {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ return username;\r
+ }\r