问题标签 [nsurlcredential]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ios - NSURLConnection 在 HTTP 401 之后不调用 NSURLConnectionDelegate 身份验证方法
我正在使用一个使用 HTTP 基本身份验证和NSURLConnection
. 在我的NSURLConnectionDelegate
, 中,我实现了–[NSURLConnectionDelegate connection:canAuthenticateAgainstProtectionSpace:]
,
–[NSURLConnectionDelegate connection:didCancelAuthenticationChallenge:]
和
–[NSURLConnectionDelegate connection:didReceiveAuthenticationChallenge:]
,但没有一个被调用。
我已经尝试实现–[NSURLConnectionDelegate connectionShouldUseCredentialStorage:]
同时返回YES
and NO
,但这没有效果。
我还确保 myNSURLCredentialStorage
是空的。
最后,我没有实现–[NSURLConnectionDelegate connection:canAuthenticateAgainstProtectionSpace:]
、
–[NSURLConnectionDelegate connection:didCancelAuthenticationChallenge:]
和
–[NSURLConnectionDelegate connection:didReceiveAuthenticationChallenge:]
,而是实现–[NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge:]
了 ,但也没有调用它。
我可以做些什么来进行NSURLConnection
callNSURLConnectionDelegate
的身份验证回调?
objective-c - 使用 NSURLConnection 的客户端 SSL 身份验证在 OS X 10.7 上不起作用
我正在编写一个 HTTPS 客户端,它使用钥匙串中的证书对服务器进行身份验证。为此,我实现了连接:willSendRequestForAuthenticationChallenge:委托。
在 10.8 上一切正常,但在 10.7 上出现错误 - “发生 SSL 错误,无法与服务器建立安全连接。”
我注意到在 10.8 上,委托被调用了两次:第一次使用 NSURLAuthenticationMethodServerTrust 方法,一次使用 NSURLAuthenticationMethodClientCertificate。
在 10.7 上,它也被调用了两次,但两次都使用 NSURLAuthenticationMethodServerTrust 方法。而且无论我如何回应它——通过 continueWithoutCredentialForAuthenticationChallenge 或通过设置由 [NSURLCredential credentialForTrust 返回的凭证——它都不起作用。
我在做什么错,以及如何让它在 10.7 上运行?
ios - NSURLCredential 身份验证,只有一个密钥
我有一个 iOS 应用程序,它登录用户,然后使用appKey
. didReceiveAuthenticationChallenge
委托方法 on足以提供NSURLConnection
带有NSURLCredential
. 但是,我在创建一个NSURLCredential
只有一个appKey
(只有一个身份验证数据,而不是两个)时遇到了麻烦。NSURLConnection
无论如何,是否可以向仅使用密钥的服务器提供身份验证详细信息?
以下curl
请求只需提供appKey
, 无密码即可完美运行:
这就是我将上述cURL
身份验证部分转换为 Objective-C 的方式:
这应该可以,但是每次我尝试时,身份验证都会失败。如您所见,我已将password
参数设置为nil
. 我也尝试填写这两个参数。似乎没有任何效果。
关于我如何只能将一个参数传递给服务器的任何想法NSURLConnection
?有没有办法从didReceiveAuthenticationChallenge
委托方法中获取错误信息(我知道didReceiveResponse
)?
ios7 - NSURLCredentialStorage not work in iOS 7
hope i'm not unique iOS 7 victim :)
I have an application that synchronize its database with my web service, in my synchronization flow there is 14 call to web services, using Windows Authentication. All this call are inside a separate thread. I created a custom class that return NSData by URL. Till iOS7 all worked fine, but with new iOS version user credential saved in sharedCredentialStorage (NSURLCredentialStorage) no longer work. Here is my code:
How I can implement an synchronous request using NTLM credentials in iOS7 :( ?
Thank you in advance, Max
ios - NSURLCredential 创建返回 null
我正在尝试NSURLCredential
使用该+credentialWithIdentity:certificates:persistence:
方法创建一个。但是它返回零。
我已经完成了以下步骤。首先,我创建了一个私钥和公钥,然后生成了一个证书并将其添加到我的钥匙串中。第一个问题,当我这样做时:
状态告诉我 mycertificateTag
是一个无效参数。如果我不放这个标签,我可以把证书放在我的钥匙串上,然后在方法里面
我放
我得到了正确的身份和证书,但凭证一直没有返回任何内容,不是错误,只是空值。知道为什么吗?
ios - iOS:NSURLAuthenticationChallenge 是否通过网络发送加密凭据?
我的 iOS 应用程序正在连接到 Sharepoint Web 服务,并且 Sharepoint 使用 NTLM 身份验证。
在我这边,我已经为 NTLM 身份验证实现了以下代码:
所以我的问题是
- 上面代码中发送的用户名和密码是加密形式的吗?
- 如果用户名和密码处于加密模式,那么 NSURLAuthenticationChallenge 是如何加密它们的?
提前致谢
objective-c - 如何将 NSURLCredential 传递给 NSURLSession?
我对此有点困惑。我有这个方法。
如何将凭据传递给 NSURLSession 对象?苹果的文档是这样说的:
“在你创建了 NSURLCredential 对象之后:
对于 NSURLSession,使用提供的完成处理程序块将对象传递给身份验证质询的发送者。”
但我不确定这实际上意味着什么。我找不到这种用法的任何例子。
谢谢。
macos - AFNetworking 2.0:如何在应用程序启动时保持 NSURLCredential
我正在使用 NSURLCredentialPersistencePermanent 创建一个 NSURLCredential 并使用它来验证 AFHTTPRequestOperation,如下所示:
一旦通过身份验证,就不再需要在以后的操作中设置凭据。
但是,一旦我重新启动应用程序,而凭证仍然存在于 中[NSURLCredentialStorage sharedCredentialStorage]
,下一个 AFHTTPRequestOperation 将不再经过身份验证并返回拒绝访问响应。
为什么 AFNetworking 无法识别共享凭证存储中存在的凭证?
objective-c - Objective-C 在 NSURLAuthenticationChallenge 之后等待响应
我是目标 C 的新手。我正在创建一个需要登录的网站的移动版本。我试图弄清楚在收到 NSURLAuthenticationChallenge 后如何允许传入用户名和密码。这是我的代码:
会话.m
用户名和密码都从 UITextField 传递到 Session 对象。这里的问题是在连接获取数据之前返回 NO。我如何告诉 logIn 方法等待凭据被传入,然后在凭据有效时等待响应?
ios - 通过 MPMoviePlayer 流式传输带有凭据的大型电影
我一直在尝试从受保护的 url 流式传输电影。我可以下载电影然后播放,但是电影太长了,这很烦人。
这是我的代码:
我已经尝试将领域链接到 nil 没有工作。我尝试在之后移动 initWitcontnetURL
那也没有用。
从方法 -(void) moviePlayBackDidFinish:(NSNotification*)notification 我得到错误 Error Domain=MediaPlayerDomain Code=-1013 "The operation could not be completed. (MediaPlayerErrorDomain error -1013.)"
查看苹果文档,这是一个 CFNetwork 错误 kCFURLErrorUserAuthenticationRequired = -1013
任何想法如何解决这个问题?