Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
Fix use correct cookies after a renew of credentials in SAML
Browse files Browse the repository at this point in the history
  • Loading branch information
nasli committed Dec 15, 2017
1 parent 94ed267 commit 10fc7c9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ public enum TextfieldType: String {
return;
}

UtilsCookies.updateOfActiveUserInDB()
self.detectUserDataAndValidate(credentials: userCredDto, serverPath: serverPath!)

}
Expand Down
1 change: 1 addition & 0 deletions Owncloud iOs Client/Network/UserData/DetectUserData.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ + (void) getUserDisplayNameOfServer:(NSString*)path credentials:(OCCredentialsDt
withCompletion:(void(^)(NSString *serverUserID, NSString *displayName, NSError *error))completion {

[[AppDelegate sharedOCCommunication] setCredentials:credentials];
DLog(@"credDto: %@",credentials.userName);

[[AppDelegate sharedOCCommunication] setValueOfUserAgent:[UtilsUrls getUserAgent]];

Expand Down
2 changes: 2 additions & 0 deletions Owncloud iOs Client/Utils/UtilsCookies.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

+ (void) eraseURLCache;

+ (void) updateCookiesOfActiveUserInDB;

+ (void) saveCurrentOfActiveUserAndClean;

+ (void) restoreCookiesOfUser:(UserDto *)user;
Expand Down
27 changes: 17 additions & 10 deletions Owncloud iOs Client/Utils/UtilsCookies.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,29 @@ + (void) eraseURLCache
[[NSURLCache sharedURLCache] setDiskCapacity:0];
}

+ (void) updateCookiesOfActiveUserInDB {
AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication]delegate];

if (app.activeUser != nil) {
DLog(@"_updateCookiesOfActiveUserInDB_");

//1- Try to Delete the cookies of the active user
[ManageCookiesStorageDB deleteCookiesByUser:app.activeUser];

//2- Store the current cookies on the Database
[UtilsCookies setOnDBStorageCookiesByUser:app.activeUser];
}
}


+ (void) saveCurrentOfActiveUserAndClean {
DLog(@"_saveAndCleanCookies_");

AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication]delegate];

//Clear the cookies before to try to do login

//1- Try to Delete the cookies of the active user
[ManageCookiesStorageDB deleteCookiesByUser:app.activeUser];

//2- Store the current cookies on the Database
if (app.activeUser != nil) {
[UtilsCookies setOnDBStorageCookiesByUser:app.activeUser];
}
//3- Clean the cookies storage
[self updateCookiesOfActiveUserInDB];

//Clean the cookies storage
[UtilsFramework deleteAllCookies];
}

Expand Down

0 comments on commit 10fc7c9

Please sign in to comment.