Foren
LRCredentials: what is the model for multiple credentials?
Daniel Wong, geändert vor 7 Jahren.
LRCredentials: what is the model for multiple credentials?
New Member Beiträge: 5 Beitrittsdatum: 19.04.16 Neueste Beiträge
I'm trying to use LRCredential to store username/password pairs (iOS SDK, version 6.2).
The documentation at https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/invoking-liferay-services-in-your-ios-app did not say what is the model when there are multiple username/password pairs for the same server, that are stored with LRCredentialStoragestoreCredentialForServer: username:password: , so I assumed it would be a simple LIFO, basically, the latest username/password pair that I stored, would be retrieved when I use [LRCredentialStorage getCredential]. getCredential doesn't take any argument, so I guessed it should be LIFO?
However, the weird thing is [LRCredentialStorage getCredential] appears to "randomly" retrieve a username/password from earlier on.
So, I thought, there is some kind of queue, and the get the password of the username I want, I can just do something like a while loop and check for the username, then be doing [LRCredentialStorage removeCredential] to remove them one by one (each time I check and find the username doesn't match). However, that doesn't work either, as subsequent calls to [LRCredentialStorage getCredential] return null. However, the next time I start the app, I can get the "next" username/password pair.
I guess I don't have a clue what is the model the LRCredentialStorage uses for multiple username/password pairs for the same server. Anyone can shed any light on this?
thanks
Daniel
The documentation at https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/invoking-liferay-services-in-your-ios-app did not say what is the model when there are multiple username/password pairs for the same server, that are stored with LRCredentialStoragestoreCredentialForServer: username:password: , so I assumed it would be a simple LIFO, basically, the latest username/password pair that I stored, would be retrieved when I use [LRCredentialStorage getCredential]. getCredential doesn't take any argument, so I guessed it should be LIFO?
However, the weird thing is [LRCredentialStorage getCredential] appears to "randomly" retrieve a username/password from earlier on.
So, I thought, there is some kind of queue, and the get the password of the username I want, I can just do something like a while loop and check for the username, then be doing [LRCredentialStorage removeCredential] to remove them one by one (each time I check and find the username doesn't match). However, that doesn't work either, as subsequent calls to [LRCredentialStorage getCredential] return null. However, the next time I start the app, I can get the "next" username/password pair.
I guess I don't have a clue what is the model the LRCredentialStorage uses for multiple username/password pairs for the same server. Anyone can shed any light on this?
thanks
Daniel
Bruno Farache, geändert vor 7 Jahren.
RE: LRCredentials: what is the model for multiple credentials?
Liferay Master Beiträge: 603 Beitrittsdatum: 14.05.07 Neueste Beiträge
Hi Daniel,
It should be only 1 username/password pair per server, and there's only one persisted server.
You can look the code here: LRCredentialStorage.m. I think you will figure out by debugging it, let us know if there's some bug on it, I've never seen this kind of credentials dirty cache before.
It should be only 1 username/password pair per server, and there's only one persisted server.
You can look the code here: LRCredentialStorage.m. I think you will figure out by debugging it, let us know if there's some bug on it, I've never seen this kind of credentials dirty cache before.