Merge branch 'mkirk/update-auth-params'

pull/1/head
Michael Kirk 7 years ago
commit 594c9aacfe

@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface RemoteAttestationAuth : NSObject @interface RemoteAttestationAuth : NSObject
@property (nonatomic) NSString *username; @property (nonatomic) NSString *username;
@property (nonatomic) NSString *authToken; @property (nonatomic) NSString *password;
@end @end
@ -135,9 +135,9 @@ NS_ASSUME_NONNULL_BEGIN
return self.auth.username; return self.auth.username;
} }
- (NSString *)authToken - (NSString *)password
{ {
return self.auth.authToken; return self.auth.password;
} }
@end @end
@ -265,7 +265,7 @@ NS_ASSUME_NONNULL_BEGIN
[[TSNetworkManager sharedManager] makeRequest:request [[TSNetworkManager sharedManager] makeRequest:request
success:^(NSURLSessionDataTask *task, id responseDict) { success:^(NSURLSessionDataTask *task, id responseDict) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
RemoteAttestationAuth *_Nullable auth = [self parseAuthToken:responseDict]; RemoteAttestationAuth *_Nullable auth = [self parseAuthParams:responseDict];
if (!auth) { if (!auth) {
DDLogError(@"%@ remote attestation auth could not be parsed: %@", self.logTag, responseDict); DDLogError(@"%@ remote attestation auth could not be parsed: %@", self.logTag, responseDict);
NSError *error = OWSErrorMakeUnableToProcessServerResponseError(); NSError *error = OWSErrorMakeUnableToProcessServerResponseError();
@ -283,16 +283,16 @@ NS_ASSUME_NONNULL_BEGIN
}]; }];
} }
- (nullable RemoteAttestationAuth *)parseAuthToken:(id)response - (nullable RemoteAttestationAuth *)parseAuthParams:(id)response
{ {
if (![response isKindOfClass:[NSDictionary class]]) { if (![response isKindOfClass:[NSDictionary class]]) {
return nil; return nil;
} }
NSDictionary *responseDict = response; NSDictionary *responseDict = response;
NSString *_Nullable token = [responseDict stringForKey:@"token"]; NSString *_Nullable password = [responseDict stringForKey:@"password"];
if (token.length < 1) { if (password.length < 1) {
OWSProdLogAndFail(@"%@ missing or empty token.", self.logTag); OWSProdLogAndFail(@"%@ missing or empty password.", self.logTag);
return nil; return nil;
} }
@ -304,7 +304,7 @@ NS_ASSUME_NONNULL_BEGIN
RemoteAttestationAuth *result = [RemoteAttestationAuth new]; RemoteAttestationAuth *result = [RemoteAttestationAuth new];
result.username = username; result.username = username;
result.authToken = token; result.password = password;
return result; return result;
} }
@ -320,7 +320,7 @@ NS_ASSUME_NONNULL_BEGIN
TSRequest *request = [OWSRequestFactory remoteAttestationRequest:keyPair TSRequest *request = [OWSRequestFactory remoteAttestationRequest:keyPair
enclaveId:enclaveId enclaveId:enclaveId
authUsername:auth.username authUsername:auth.username
authPassword:auth.authToken]; authPassword:auth.password];
[[TSNetworkManager sharedManager] makeRequest:request [[TSNetworkManager sharedManager] makeRequest:request
success:^(NSURLSessionDataTask *task, id responseJson) { success:^(NSURLSessionDataTask *task, id responseJson) {

Loading…
Cancel
Save