From: masensio Date: Thu, 9 Jan 2014 10:07:54 +0000 (+0100) Subject: OC-2465: Move getUserNameForSamlSso to AccountUtils in oc_framework X-Git-Tag: oc-android-1.5.5~73^2~11 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/fe6ab707e4bef8ac835936d55b2dfd7a6d9e65f2?ds=inline;hp=--cc OC-2465: Move getUserNameForSamlSso to AccountUtils in oc_framework --- fe6ab707e4bef8ac835936d55b2dfd7a6d9e65f2 diff --git a/oc_framework/src/com/owncloud/android/oc_framework/accounts/AccountUtils.java b/oc_framework/src/com/owncloud/android/oc_framework/accounts/AccountUtils.java index 810f3eba..e42d1bf7 100644 --- a/oc_framework/src/com/owncloud/android/oc_framework/accounts/AccountUtils.java +++ b/oc_framework/src/com/owncloud/android/oc_framework/accounts/AccountUtils.java @@ -24,6 +24,7 @@ import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountsException; import android.content.Context; +import android.net.Uri; public class AccountUtils { public static final String WEBDAV_PATH_1_2 = "/webdav/owncloud.php"; @@ -34,6 +35,9 @@ public class AccountUtils { public static final String CARDDAV_PATH_2_0 = "/apps/contacts/carddav.php"; public static final String CARDDAV_PATH_4_0 = "/remote/carddav.php"; public static final String STATUS_PATH = "/status.php"; + + // Key for UserName in Saml Cookie + private static final String KEY_OC_USERNAME_EQUALS = "oc_username="; /** * @@ -125,5 +129,23 @@ public class AccountUtils { return mFailedAccount; } } + + /** + * Get the UserName for the SamlSso cookie + * @param authToken + * @return userName + */ + public static String getUserNameForSamlSso(String authToken) { + if (authToken != null) { + String [] cookies = authToken.split(";"); + for (int i=0; i