留言板

LRCredentials: what is the model for multiple credentials?

Daniel Wong,修改在7 年前。

LRCredentials: what is the model for multiple credentials?

New Member 帖子: 5 加入日期: 16-4-19 最近的帖子
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
thumbnail
Bruno Farache,修改在7 年前。

RE: LRCredentials: what is the model for multiple credentials?

Liferay Master 帖子: 603 加入日期: 07-5-14 最近的帖子
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.