From fe6ab707e4bef8ac835936d55b2dfd7a6d9e65f2 Mon Sep 17 00:00:00 2001 From: masensio Date: Thu, 9 Jan 2014 11:07:54 +0100 Subject: [PATCH 1/1] OC-2465: Move getUserNameForSamlSso to AccountUtils in oc_framework --- .../oc_framework/accounts/AccountUtils.java | 22 +++++++++++++++ .../authentication/AuthenticatorActivity.java | 33 +++++++++++----------- 2 files changed, 39 insertions(+), 16 deletions(-) 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