GrahamDennis/GDFileManagerKit

Logging out?

Opened this issue · 5 comments

Heya, I'm trying to allow the user to "logout" of a session (so he could theoretically pass the iPad to a friend without fear of them seeing their private accounts) but I'm confused by the the layers of sessions, clients, file services, keychains, etc.

So far I can delete the keychain value just fine (so when the program closes and re-opens, you're logged out) but I cant seem to be able to make the logout immediate, I've tried a bunch of things, unsetting sessions, removing all file services and adding them again, to no avail. I'm kinda new to objective-c too so it might not help.

If you have a few minutes to spare and an idea of a way it would be doable, it would be very appreciated.

-[GDFileServiceSession unlink] is supposed to do this, but it may be incomplete. Also, the method should probably be called logOut.

Currently -[GDFileServiceSession unlink] removes the file service session from its file service, but we should also remove the credentials from the GDClientManager (which will also delete them from the keychain).

So, given an GDFileServiceSession called session we should do:

GDClientManager *clientManager = session.fileService.clientManager ;
while ((GDClientCredential *credential = [clientManager credentialForUserID:session.client.userID])) {
    [clientManager removeCredential:credential];
}

That should work, but let me know if it doesn't.

After testing this out, it does the same thing all my previous attempts did, it indeeds logs the user out, but you still have access to files and folders. If you close the app and start it again, then the user is logged out and you have to log back in. There must be another spot where some infos are kept, otherwise the user shouldn't be able to access his data without having to re-enter his username/password, no?

The same here. If I select GDrive module for instance I get an alert view. The operation couldn't be completed. GDFileManagerErrorDomain error 101.

Next app restart, it implements the logout.

Work around solution: just remove current service from self.tableData NSArray

It works . Thanks a lot