Security: adds authentication to updates websocket operation
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#import "MBIMBridgeOperation.h"
|
||||
#import "MBIMAuthToken.h"
|
||||
#import "MBIMUpdateQueue.h"
|
||||
#import "MBIMURLUtilities.h"
|
||||
|
||||
#import <Security/Security.h>
|
||||
#import <CocoaHTTPServer/HTTPMessage.h>
|
||||
@@ -130,7 +131,14 @@
|
||||
{
|
||||
NSURL *url = [NSURL URLWithString:path];
|
||||
NSString *endpointName = [url lastPathComponent];
|
||||
NSString *authTokenString = [url valueForQueryItemWithName:@"token"];
|
||||
MBIMAuthToken *authToken = [[MBIMAuthToken alloc] initWithTokenString:authTokenString];
|
||||
|
||||
if ([endpointName isEqualToString:@"updates"]) {
|
||||
if (![authToken isValid]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[MBIMUpdateQueue sharedInstance] vendUpdateWebSocketConsumerForRequest:request socket:asyncSocket];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user