This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pluggable policies are currently only in our fork, but pending upstream PR: facebookincubator/SocketRocket#429 Also: * rebased SocketRocket against latest upstream to incorporate bug fixes. * adapt to new upstream API for error handling (vs previous exception throwing) * renamed AFSecurityOWSPolicy -> OWSHTTPSecurityPolicy to differentiate it from OSWWebSocketSecurityPolicy * Follow conventional singleton pattern with onceToken // FREEBIE
- Loading branch information
1 parent
80671b2
commit e20f506
Showing
10 changed files
with
72 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// Created by Fred on 01/09/15. | ||
// Copyright © 2015 Open Whisper Systems. All rights reserved. | ||
// | ||
|
||
#import <AFNetworking/AFSecurityPolicy.h> | ||
|
||
@interface OWSHTTPSecurityPolicy : AFSecurityPolicy | ||
|
||
+ (instancetype)sharedPolicy; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright © 2016 Open Whisper Systems. All rights reserved. | ||
|
||
#import <SocketRocket/SRSecurityPolicy.h> | ||
|
||
@interface OWSWebsocketSecurityPolicy : SRSecurityPolicy | ||
|
||
+ (instancetype)sharedPolicy; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright © 2016 Open Whisper Systems. All rights reserved. | ||
|
||
#import "OWSWebsocketSecurityPolicy.h" | ||
|
||
#import <SocketRocket/SRSecurityPolicy.h> | ||
#import "OWSHTTPSecurityPolicy.h" | ||
|
||
@implementation OWSWebsocketSecurityPolicy | ||
|
||
+ (instancetype)sharedPolicy { | ||
static OWSWebsocketSecurityPolicy *websocketSecurityPolicy = nil; | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
websocketSecurityPolicy = [[self alloc] initWithValidatesCertificateChain:NO]; | ||
}); | ||
return websocketSecurityPolicy; | ||
} | ||
|
||
- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain { | ||
// Delegate server trust to our existing HTTP policy. | ||
return [[OWSHTTPSecurityPolicy sharedPolicy] evaluateServerTrust:serverTrust forDomain:domain]; | ||
} | ||
|
||
@end |