NTLM/Kerberos在浏览器上工作,但与Alamofire的应用不使用
由于我们的服务器的身份验证更改,因此我必须在iOS应用中添加Kerberos Authent。我尝试了在互联网上找到的所有内容,但没有任何作用。
这是我的代码
private static let sessionManager: Session = {
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 25
configuration.timeoutIntervalForResource = 25
configuration.urlCredentialStorage = nil
let retrier = RetryPolicy()
return Session(configuration: configuration, interceptor: retrier)
}()
private static func performRequest<T: Decodable>(email: String = email ?? "",
password: String = password ?? "",
route: APIRouter,
decoder: JSONDecoder = JSONDecoder(),
completion: @escaping (AFResult<T>) -> Void) {
let credential = URLCredential(user: email, password: password, persistence: .permanent)
sessionManager.request(route)
.authenticate(with: credential)
.responseDecodable(decoder: decoder) { completion($0.result) }
}
,并调用perferrequest
,其良好信息会导致不良回报。
同时,如果我去Safari et的路线与良好的标识符联系在一起,我会收到良好的JSON。 我看到的东西很少有挑战,但这似乎是针对较旧版本的Alamofire。
那么,为什么它在浏览器上可以正常工作,而不是在我的应用程序上工作呢?我了解为Safari工作的人们是一个非常好的开发人员,但仍然如此。
谢谢
Since an authentication change in our server, I have to add kerberos authent in our ios app. I tried everything found on internet but nothing works.
Here is my code
private static let sessionManager: Session = {
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 25
configuration.timeoutIntervalForResource = 25
configuration.urlCredentialStorage = nil
let retrier = RetryPolicy()
return Session(configuration: configuration, interceptor: retrier)
}()
private static func performRequest<T: Decodable>(email: String = email ?? "",
password: String = password ?? "",
route: APIRouter,
decoder: JSONDecoder = JSONDecoder(),
completion: @escaping (AFResult<T>) -> Void) {
let credential = URLCredential(user: email, password: password, persistence: .permanent)
sessionManager.request(route)
.authenticate(with: credential)
.responseDecodable(decoder: decoder) { completion($0.result) }
}
and calling performRequest
with the good info lead to a bad return.
While, if I go to the route on Safari et connect with the good identifiers, I receive the good json.
I saw few things with challenge, but it seems to be for older version of alamofire.
So why it's works fine on browser and not on my app? I understand people working for Safari a very good developers, but still.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论