首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏正则

    AFNetworking源码探究(五) —— AFURLSessionManager

    NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential // 而这个证书就需要使用credentialForTrust:来创建一个NSURLCredential对象 if ([challenge.protectionSpace.authenticationMethod // 创建挑战证书(注:挑战方式为UseCredential和PerformDefaultHandling都需要新建挑战证书) credential = [NSURLCredential 接收到挑战后,客户端要根据服务端传来的challenge来生成completionHandler所需的NSURLSessionAuthChallengeDisposition disposition和NSURLCredential

    44630发布于 2021-09-02
  • 来自专栏一“技”之长

    深入理解HTTPS及在iOS系统中适配HTTPS类型网络请求(下)

    解析如下: //使用凭证进行验证 - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence; //同上 + (NSURLCredential NSArray *)certArray persistence:(NSURLCredentialPersistence)persistence NS_AVAILABLE(10_6, 3_0); //同上 + (NSURLCredential 创建证书信任凭证 用户自签名的HTTPS请求 - (instancetype)initWithTrust:(SecTrustRef)trust NS_AVAILABLE(10_6, 3_0); //同上 + (NSURLCredential NSURLSessionAuthChallengeDisposition(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential

    97310发布于 2018-08-15
  • 来自专栏云原生布道专栏

    IOS开发系列——NSUrlSession专题

    *card =[[NSURLCredential alloc] initWithTrust:challenge.protectionSpace.serverTrust]; completionHandler *credential = [NSURLCredential credentialWithUser:kGlobal.userInfo.sAccountpassword:kGlobal.userInfo.sPassword *card = [[NSURLCredential alloc]initWithTrust:challenge.protectionSpace.serverTrust]; //completionHandler (NSURLSessionAuthChallengeUseCredential,card); //[challenge.sender useCredential:[NSURLCredential credentialForTrust kakaluote123/articles/5426923.html HTTP协议授权访问 http://blog.csdn.net/yangtiang/article/details/22793215 NSURLCredential

    1.1K30编辑于 2023-10-11
  • 来自专栏向治洪

    iOS使用自签名证书实现HTTPS请求

    // The only good exit point NSLog(@"信任该证书"); NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; forAuthenticationChallenge: challenge]; } while(0); } // Bad dog NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; completionHandler NSURLSessionAuthChallengeDisposition(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential

    2.8K100发布于 2018-01-26
  • 来自专栏正则

    AFNetworking源码探究(六) —— AFURLSessionManager(2)

    NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential disposition = NSURLSessionAuthChallengeUseCredential; credential = [NSURLCredential

    76530发布于 2021-09-02
  • 来自专栏韦弦的偶尔分享

    iOS HTTPS 请求 Code=-999 "cancelled"

    NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential completionHandler { //不校验证书 - 信任所有证书 completionHandler(NSURLSessionAuthChallengeUseCredential, [[NSURLCredential

    3.3K20发布于 2020-02-18
  • 来自专栏欧阳大哥的轮子

    HTTP协议中的401授权认证机制在iOS上的实现

    value是一个字典,其中value的key是用户名字,value是凭证 -(NSDictionary *)allCredentials; //保存凭证 -(void)setCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space; //删除凭证 -(void)removeCredential:(NSURLCredential :(NSURLProtectionSpace *)space; //获取某个凭证空间的默认凭证 -(void)setDefaultCredential:(NSURLCredential*)credential (NSURLProtectionSpace*)protectionSpace; //上次客户端接收挑战时所指定的认证的凭证,在没有指定时默认为nil -(NSURLCredential*)proposedCredential -(void)useCredential:(NSURLCredential*)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge

    1.9K30发布于 2018-08-22
  • 来自专栏joealzhou

    iOS 中 HTTPS 证书验证浅析

    status == kSecTrustResultUnspecified)) { //3)验证成功继续请求操作 [challenge.sender useCredential:[NSURLCredential NSURLCredential 表示身份验证证书。 因此NSURLCredential可以表示由用户名/密码组合、客户端证书及服务器信任创建的认证信息,适合大部分的认证请求。 对于NSURLCredential也存在三种持久化机制: NSURLCredentialPersistenceNone :要求 URL 载入系统 “在用完相应的认证信息后立刻丢弃”。 如第二步验证通过了,一般的安全要求下,就可以直接验证通过,进入到下一步:使用Trust Object生成一份凭证([NSURLCredential credentialForTrust:serverTrust

    2.8K30发布于 2019-09-25
  • 来自专栏向治洪

    iOS使用自签名证书实现HTTPS请求

    case) */ #endif // The only good exit point NSLog(@"信任该证书"); NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; completionHandler NSURLSessionAuthChallengeDisposition(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { credential = [NSURLCredential

    4.8K90发布于 2018-02-05
  • 来自专栏xx_Cc的学习总结专栏

    iOS-网络编程(三)AFNetworking使用

    NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { //创建证书 NSURLCredential *credentoal = [[NSURLCredential alloc]initWithTrust:challenge.protectionSpace.serverTrust];

    2.5K70发布于 2018-05-10
  • 来自专栏日常技术分享

    iOS AFNetworking 源码阅读二

    NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential // 而这个证书就需要使用credentialForTrust:来创建一个NSURLCredential对象 if ([challenge.protectionSpace.authenticationMethod // 创建挑战证书(注:挑战方式为UseCredential和PerformDefaultHandling都需要新建挑战证书) credential = [NSURLCredential NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential disposition = NSURLSessionAuthChallengeUseCredential; credential = [NSURLCredential

    2K20发布于 2018-12-17
  • 来自专栏iOS开发攻城狮的集散地

    WKWebView的使用

    NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable credential))completionHandler{ //用户身份信息 NSURLCredential * newCred = [[NSURLCredential

    3.6K61发布于 2018-06-19
  • 来自专栏腾讯Bugly的专栏

    iOS 中 HTTPS 证书验证浅析

    NSURLCredential 表示身份验证证书。 因此NSURLCredential可以表示由用户名/密码组合、客户端证书及服务器信任创建的认证信息,适合大部分的认证请求。 对于NSURLCredential也存在三种持久化机制: NSURLCredentialPersistenceNone :要求 URL 载入系统 “在用完相应的认证信息后立刻丢弃”。 如第二步验证通过了,一般的安全要求下,就可以直接验证通过,进入到下一步:使用Trust Object生成一份凭证([NSURLCredential credentialForTrust:serverTrust

    5K90发布于 2018-03-23
  • 来自专栏正则

    AFNetworking源码探究(四) —— GET请求实现之代理转发思想

    AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential AFURLSessionTaskDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential

    53820发布于 2021-09-02
  • 来自专栏iOS技术杂谈

    iOS网络——NSURLSession详解及SDWebImage源码解析你要知道的NSURLSession都在这里

    是否压缩图片的setter和getter - (BOOL)shouldDecompressImages; - (void)setShouldDecompressImages:(BOOL)value; //NSURLCredential 的setter和getetr - (nullable NSURLCredential *)credential; - (void)setCredential:(nullable NSURLCredential Kept only for backwards compatibility"); //https需要使用的凭证 @property (nonatomic, strong, nullable) NSURLCredential NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential disposition = NSURLSessionAuthChallengePerformDefaultHandling; } else { credential = [NSURLCredential

    3.5K100发布于 2018-04-10
  • 来自专栏用户7498074的专栏

    ​# iOS WKWebView适配(基础篇)

    NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) { NSURLCredential *card = [[NSURLCredential alloc] initWithTrust:challenge.protectionSpace.serverTrust]; completionHandler

    4.6K30发布于 2020-06-24
  • 来自专栏网罗开发

    分享超详细 WKWebView 开发和使用经验

    忽略书证, 并取消这次请求 NSURLSessionAuthChallengeRejectProtectionSpace = 3, 拒绝当前这一次, 下一次再询问 */ // NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; NSURLCredential *card = [[NSURLCredential alloc]initWithTrust:challenge.protectionSpace.serverTrust]; completionHandler

    6K30发布于 2021-08-13
  • 来自专栏iOS技术杂谈

    iOS网络——AFNetworking AFURLSessionManager源码解析

    NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { credential = [NSURLCredential NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential disposition = NSURLSessionAuthChallengeUseCredential; credential = [NSURLCredential

    4.8K70发布于 2018-04-10
  • 来自专栏一“技”之长

    iOS网络编程之一——iOS网络框架简介 原

    3.NSURLCredential、NSURLProtectionSpace、NSURLCredentialStorage、NSURLAuthenticatioChallenge         一些访问请求需要证书或者身份凭证进行验证

    1.5K21发布于 2018-08-16
  • 来自专栏一“技”之长

    iOS中WebKit框架应用与解析 原

    NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler{ //用户身份信息 NSURLCredential *newCred = [NSURLCredential credentialWithUser

    2.4K40发布于 2018-08-15
领券