如何存储非标准的Web认证?
在与我的应用程序通信的 Web API 中,身份验证过程按以下方式设计:
- 用户输入他/她所属的
组
名称。 - 服务器发送群组成员列表。
- 用户选择
用户名
并输入密码
。 - 我的应用程序将由
组 id
、用户 id
和密码
构造的哈希发送到服务器以验证凭据,并在验证成功的情况下使用在进一步的交易中使用这个哈希值。
通过此过程,我没有收到标准 NSURLConnection
消息,例如 connection:canAuthenticateAgainstProtectionSpace:
或 connection:didReceiveAuthenticationChallenge:
。
我本身可以处理它,但是当涉及到安全存储凭证时,我感到困惑。有没有办法通过一些内置的 iOS SDK 方法来做到这一点,或者我必须手动将哈希值写入文件中?正确的方法是什么?
In the web API my app communicates with, the authentication process is designed in the following way:
- The user enters the name of the
group
that he/she belongs to. - The server sends the list of group members.
- The user chooses a
user name
and types apassword
. - My app sends a hash constructed of the
group id
,user id
andpassword
to the server to validate the credentials and in case of successful validation uses this hash in further transactions.
Having this process, I do not get standard NSURLConnection
messages like connection:canAuthenticateAgainstProtectionSpace:
or connection:didReceiveAuthenticationChallenge:
.
I can deal with it per se, but when it comes to securely storing the credentials, I get confused. Is there a way to do this via some built-in iOS SDK methods or I have to write the hash in a file manually, for example? What's the proper way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
钥匙串似乎是存储用户凭据/哈希的最佳选择。
查看 http://developer.apple。 com/library/mac/#documentation/Security/Conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html
和 https://github.com/ldandersen/scifihifi-iphone/tree/05e64ff2814a8192c43f1f81eb8e09dc3764fa18/security
编辑:查看 http://overhrd.com/?p=208
您可以通过这种性质的简单调用来访问钥匙串上的数据:
The keychain seems the best option to store the user's credentials/hash.
Check out http://developer.apple.com/library/mac/#documentation/Security/Conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html
And https://github.com/ldandersen/scifihifi-iphone/tree/05e64ff2814a8192c43f1f81eb8e09dc3764fa18/security
Edit: Look at http://overhrd.com/?p=208
You'd be able to access the data on your keychain with simple calls of this nature: