You've already forked hotpocket
BTHLABS-66: Prepping for public release: Take five
AKA "Using Apple reviewers as QA for your project". Thanks, y'all! :)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#import "HPAPI.h"
|
||||
#import "HPCredentialsHelper.h"
|
||||
#import "HPRPCClient.h"
|
||||
#import "NSBundle+HotPocketExtensions.h"
|
||||
#import "NSURL+HotPocketExtensions.h"
|
||||
|
||||
@implementation HPAuthParams
|
||||
@@ -77,18 +78,19 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSDictionary *postAuthenticateURLParams = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"HPAuthFlowPostAuthenticateURLParts"];
|
||||
if (postAuthenticateURLParams == nil) {
|
||||
NSString *expectedScheme = [NSBundle postAuthenticateURLScheme];
|
||||
NSString *expectedHost = [NSBundle postAuthenticateURLHost];
|
||||
if (expectedScheme == nil || expectedHost == nil) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
|
||||
|
||||
if ([urlComponents.scheme isEqualToString:[postAuthenticateURLParams valueForKey:@"scheme"]] == NO) {
|
||||
if ([urlComponents.scheme isEqualToString:expectedScheme] == NO) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ([urlComponents.host isEqualToString:[postAuthenticateURLParams valueForKey:@"host"]] == NO) {
|
||||
if ([urlComponents.host isEqualToString:expectedHost] == NO) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface NSBundle (HotPocketExtensions)
|
||||
|
||||
+(NSString *)uname;
|
||||
+(NSDictionary *)postAuthenticateURLParams;
|
||||
+(NSString *)postAuthenticateURLScheme;
|
||||
+(NSString *)postAuthenticateURLHost;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -14,4 +14,23 @@
|
||||
return [NSString stringWithFormat:@"HotPocket v%@ (%@)", [mainBundle.infoDictionary valueForKey:@"CFBundleShortVersionString"], [mainBundle.infoDictionary valueForKey:@"CFBundleVersion"]];
|
||||
}
|
||||
|
||||
+(NSDictionary *)postAuthenticateURLParams {
|
||||
NSDictionary *result = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"HPAuthFlowPostAuthenticateURLParts"];
|
||||
if (result == nil) {
|
||||
return [NSDictionary dictionary];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+(NSString *)postAuthenticateURLScheme {
|
||||
NSDictionary *params = [self postAuthenticateURLParams];
|
||||
return [params valueForKey:@"scheme"];
|
||||
}
|
||||
|
||||
+(NSString *)postAuthenticateURLHost {
|
||||
NSDictionary *params = [self postAuthenticateURLParams];
|
||||
return [params valueForKey:@"host"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user