Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.
Merged
41 changes: 29 additions & 12 deletions MASFoundation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@
C81CC3CD1FC2EA190058718E /* MASBrowserBasedAuthentication.m in Sources */ = {isa = PBXBuildFile; fileRef = C81CC3CB1FC2EA190058718E /* MASBrowserBasedAuthentication.m */; };
C81CC3D01FC2EFBB0058718E /* UIAlertController+MAS.h in Headers */ = {isa = PBXBuildFile; fileRef = C81CC3CE1FC2EFBB0058718E /* UIAlertController+MAS.h */; };
C81CC3D11FC2EFBB0058718E /* UIAlertController+MAS.m in Sources */ = {isa = PBXBuildFile; fileRef = C81CC3CF1FC2EFBB0058718E /* UIAlertController+MAS.m */; };
C858D6B52398FC5400963763 /* MASDataTask+MASPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = C858D6B32398FC5400963763 /* MASDataTask+MASPrivate.h */; };
C858D6B62398FC5400963763 /* MASDataTask+MASPrivate.m in Sources */ = {isa = PBXBuildFile; fileRef = C858D6B42398FC5400963763 /* MASDataTask+MASPrivate.m */; };
C8B1700B238FD1A7007BB903 /* MASDataTask.h in Headers */ = {isa = PBXBuildFile; fileRef = C8B17009238FD1A7007BB903 /* MASDataTask.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8B1700C238FD1A7007BB903 /* MASDataTask.m in Sources */ = {isa = PBXBuildFile; fileRef = C8B1700A238FD1A7007BB903 /* MASDataTask.m */; };
C8C32B0D22D706B900D64DF0 /* MASMultiPartFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = C8C32B0C22D706B900D64DF0 /* MASMultiPartFormData.h */; settings = {ATTRIBUTES = (Public, ); }; };
C8C32B1022D7163100D64DF0 /* MASMultiPartRequestSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = C8C32B0E22D7163100D64DF0 /* MASMultiPartRequestSerializer.h */; };
C8C32B1122D7163100D64DF0 /* MASMultiPartRequestSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = C8C32B0F22D7163100D64DF0 /* MASMultiPartRequestSerializer.m */; };
Expand Down Expand Up @@ -569,6 +573,10 @@
C81CC3CB1FC2EA190058718E /* MASBrowserBasedAuthentication.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MASBrowserBasedAuthentication.m; sourceTree = "<group>"; };
C81CC3CE1FC2EFBB0058718E /* UIAlertController+MAS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIAlertController+MAS.h"; sourceTree = "<group>"; };
C81CC3CF1FC2EFBB0058718E /* UIAlertController+MAS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIAlertController+MAS.m"; sourceTree = "<group>"; };
C858D6B32398FC5400963763 /* MASDataTask+MASPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MASDataTask+MASPrivate.h"; sourceTree = "<group>"; };
C858D6B42398FC5400963763 /* MASDataTask+MASPrivate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "MASDataTask+MASPrivate.m"; sourceTree = "<group>"; };
C8B17009238FD1A7007BB903 /* MASDataTask.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MASDataTask.h; sourceTree = "<group>"; };
C8B1700A238FD1A7007BB903 /* MASDataTask.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MASDataTask.m; sourceTree = "<group>"; };
C8C32B0C22D706B900D64DF0 /* MASMultiPartFormData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MASMultiPartFormData.h; sourceTree = "<group>"; };
C8C32B0E22D7163100D64DF0 /* MASMultiPartRequestSerializer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MASMultiPartRequestSerializer.h; sourceTree = "<group>"; };
C8C32B0F22D7163100D64DF0 /* MASMultiPartRequestSerializer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MASMultiPartRequestSerializer.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1112,6 +1120,8 @@
699570E52062FF1300017244 /* MASError.m */,
699570E02060650400017244 /* MASNotifications.h */,
699570E12060650400017244 /* MASNotifications.m */,
C8B17009238FD1A7007BB903 /* MASDataTask.h */,
C8B1700A238FD1A7007BB903 /* MASDataTask.m */,
107389F21C7118F800B7E87E /* MQTT */,
A419B39A1C17622E008DC88C /* categories */,
A4831A9A1BD1A551007B4AE6 /* models */,
Expand Down Expand Up @@ -1267,6 +1277,8 @@
CB3173DF1F1FFF2C00C85E47 /* MASNetworkMonitor.m */,
CBBA9A7E20742BA800BB307F /* MASNetworkReachability.h */,
CBBA9A7F20742BA800BB307F /* MASNetworkReachability.m */,
C858D6B32398FC5400963763 /* MASDataTask+MASPrivate.h */,
C858D6B42398FC5400963763 /* MASDataTask+MASPrivate.m */,
);
path = internal;
sourceTree = "<group>";
Expand Down Expand Up @@ -1551,6 +1563,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
C8B1700B238FD1A7007BB903 /* MASDataTask.h in Headers */,
C8C32B0D22D706B900D64DF0 /* MASMultiPartFormData.h in Headers */,
CB2A4048209A341A00F988AA /* MASMultiFactorHandler.h in Headers */,
CB1FD14B1FB23701000AFA25 /* MASSharedStorage.h in Headers */,
Expand Down Expand Up @@ -1631,6 +1644,7 @@
A46F49D31C2F5FC500A4C370 /* MASIURLRequestSerialization.h in Headers */,
A4831AB11BD1A551007B4AE6 /* MASFile.h in Headers */,
699570E22060650400017244 /* MASNotifications.h in Headers */,
C858D6B52398FC5400963763 /* MASDataTask+MASPrivate.h in Headers */,
1059D3761B61AA3800223267 /* MASFoundation.h in Headers */,
A898EF6B2182D3DF00CF291B /* NSURLSession+MASPrivate.h in Headers */,
A46F49CD1C2F5FC500A4C370 /* MASINetworkReachabilityManager.h in Headers */,
Expand Down Expand Up @@ -1783,6 +1797,7 @@
TargetAttributes = {
1059D36F1B61AA3700223267 = {
CreatedOnToolsVersion = 6.4;
DevelopmentTeam = 2JJZ96P8P5;
ProvisioningStyle = Manual;
};
1059D37A1B61AA3800223267 = {
Expand Down Expand Up @@ -1955,6 +1970,7 @@
CB9975471EDF5799006CEBB1 /* MASAuthCredentials+MASPrivate.m in Sources */,
CB273F011DF8C5BF00AF2BDB /* L7SBrowserURLProtocol.m in Sources */,
CB9975531EDF591C006CEBB1 /* MASAuthCredentialsJWT.m in Sources */,
C858D6B62398FC5400963763 /* MASDataTask+MASPrivate.m in Sources */,
CBD25B041E78C47C00DFB47F /* JWTCoding+VersionOne.m in Sources */,
CB9B1208210949D5008A2075 /* NSMutableData+MASASN1Helper.m in Sources */,
CB99754B1EDF57D6006CEBB1 /* MASAuthCredentialsPassword.m in Sources */,
Expand All @@ -1979,6 +1995,7 @@
CB6491FA1FE9DAF300281288 /* MQTTSessionSynchron.m in Sources */,
A4831AB01BD1A551007B4AE6 /* MASDevice.m in Sources */,
CBD25B001E78C47C00DFB47F /* JWTClaimsSetVerifier.m in Sources */,
C8B1700C238FD1A7007BB903 /* MASDataTask.m in Sources */,
A46F49E31C2F5FC500A4C370 /* UIImageView+MASINetworking.m in Sources */,
A421571C1BF863480034BDC9 /* MASServiceRegistry.m in Sources */,
CBD25AEB1E78C47C00DFB47F /* JWTAlgorithmDataHolder.m in Sources */,
Expand Down Expand Up @@ -2066,7 +2083,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
Expand Down Expand Up @@ -2115,7 +2132,7 @@
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
Expand Down Expand Up @@ -2143,13 +2160,13 @@
1059D3871B61AA3800223267 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2.0.00;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 2JJZ96P8P5;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -2191,13 +2208,13 @@
1059D3881B61AA3800223267 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 2.0.00;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 2JJZ96P8P5;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -2239,7 +2256,7 @@
1059D38A1B61AA3800223267 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 2JJZ96P8P5;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -2262,7 +2279,7 @@
1059D38B1B61AA3800223267 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 2JJZ96P8P5;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -2281,7 +2298,7 @@
1059D3BA1B61C00500223267 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
ENABLE_BITCODE = YES;
MACH_O_TYPE = staticlib;
Expand All @@ -2293,7 +2310,7 @@
1059D3BB1B61C00500223267 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
ENABLE_BITCODE = YES;
MACH_O_TYPE = staticlib;
Expand Down
82 changes: 82 additions & 0 deletions MASFoundation/Classes/MAS.h
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,32 @@ withParameters:(NSDictionary *_Nullable)parameterInfo
+ (void)invoke:(nonnull MASRequest *)request completion:(nullable MASResponseObjectErrorBlock)completion;


/**
* Invoke the endpoint with the parameters defined in the MASRequest object and also cancel a pending request using the taskBlock
*
* If endPointPath is full URL format (including port number and http protocol), SDK will validate the server from the client side through SSL pinning (authentication challenge) with
* provided subjectKeyHash (also known as public key hash) in configuration in mag.mobile_sdk.trusted_cert_pinned_public_key_hashes and mag.mobile_sdk.enable_public_key_pinning.
* ALL of servers' public key hashes in certificate chain must be defined in the list. This means when it is configured to use public key hash pinning for SSL pinning,
* subjectKeyHash (public key hash) of the gateway must be also present within the list. The list can contain multiple hash values in array for multiple servers.
*
* When SDK fails to validate SSL with certificate or subjectKeyHash pinning for communication to HTTPs, SDK will cancel the request.
*
* If endPointPath is full URL format, upon successful SSL pinning validation, SDK will also validate the user session against primary gateway regardless the request is being made
* to the primary gateway or not. To ensure bypass the user session validation for public API, use [MAS deleteFrom:withParameters:requestType:responseType:isPublic:completion:] method
* with isPublic being YES.
*
* @param request MASRequest An object containing all parameters to call the endpoint
* When the value is set to true, all automatically injected credentials in SDK will be excluded in the request.
* @param dataTask MASDataTaskBlock A block which gives a MASDataTask object that can be used to cancel the request
* @param completion An MASResponseObjectErrorBlock (NSHTTPURLResponse *response, id responseObject, NSError *error) that will
* receive the NSHTTPURLResponse object, response object which needs to perform type casting based on the object type, and NSError object when error occurs.
@see cancelRequest
*/

+ (void)invoke:(nonnull MASRequest *)request taskBlock:(nullable MASDataTaskBlock)taskBlock completion:(nullable MASResponseObjectErrorBlock)completion;




# pragma mark - FILE Requests

Expand Down Expand Up @@ -1088,6 +1114,62 @@ withParameters:(NSDictionary *_Nullable)parameterInfo
*/
+ (void)postMultiPartForm:(nonnull MASRequest *)request constructingBodyWithBlock:(nonnull MASMultiPartFormDataBlock)formDataBlock progress:( MASFileRequestProgressBlock _Nullable )progressBlock completion:(nullable MASResponseObjectErrorBlock)completion;


/**
* Post a multi-part form with the parameters defined in the MASRequest object
*
* If endPointPath is full URL format (including port number and http protocol), SDK will validate the server from the client side through SSL pinning (authentication challenge) with
* provided subjectKeyHash (also known as public key hash) in configuration in mag.mobile_sdk.trusted_cert_pinned_public_key_hashes and mag.mobile_sdk.enable_public_key_pinning.
* ALL of servers' public key hashes in certificate chain must be defined in the list. This means when it is configured to use public key hash pinning for SSL pinning,
* subjectKeyHash (public key hash) of the gateway must be also present within the list. The list can contain multiple hash values in array for multiple servers.
*
* When SDK fails to validate SSL with certificate or subjectKeyHash pinning for communication to HTTPs, SDK will cancel the request.
*
* If endPointPath is full URL format, upon successful SSL pinning validation, SDK will also validate the user session against primary gateway regardless the request is being made
* to the primary gateway or not. To ensure bypass the user session validation for public API, use [MAS deleteFrom:withParameters:requestType:responseType:isPublic:completion:] method
* with isPublic being YES.
*
* The API appends the file data and any other parameters to the body and follows the standards defined for Content-Type = multipart/form-data
*
* @param request MASRequest An object containing all parameters to call the endpoint
* When the value is set to true, all automatically injected credentials in SDK will be excluded in the request.
* @param formDataBlock This is a block that gets called while constructing the body of the multi-part form request. Typically files can be added to the body by calling various APIs available in MASMultiPartFormData
* @see MASMultiPartFormData
* @param progressBlock Block which gives back the NSProgress of the task that is going on. Different values can be read from the progress object to present a meaningful progress updates in the UI. Recommend to use progress.fractioncompleted for progress bar updates.
* @param taskBlock Block which gives back handle to the underlying task object. This task can be cancelled by calling cancel on the object.
* @param completion An MASResponseObjectErrorBlock (NSHTTPURLResponse *response, id responseObject, NSError *error) that will
* receive the NSHTTPURLResponse object, response object which needs to perform type casting based on the object type, and NSError object when error occurs.
@see cancelRequest
*/
+ (void)postMultiPartForm:(nonnull MASRequest *)request constructingBodyWithBlock:(nonnull MASMultiPartFormDataBlock)formDataBlock progress:( MASFileRequestProgressBlock _Nullable )progressBlock taskBlock:(MASDataTaskBlock _Nullable )taskBlock completion:(nullable MASResponseObjectErrorBlock)completion;


///--------------------------------------
/// @name Cancel HTTP Requests
///--------------------------------------
# pragma mark - Cancel APIs

/**
* API to cancel a pending HTTP request that was invoked using the API invoke:taksBlock:completion:
* This is a best effort cancel and uses the underlying cancel functionality of iOS.
* This means there could be scenarios where the request has already been complete and the response is received. In such cases calling cancel has no real meaning.
* The completion handler returns with an error description that the task has been cancelled. But in some cases if the request has a dependent Task like a login to be completed, then calling cancel on the request may not return a response back as the task has not been started yet.
* Cancelling an already finished task has no effect.
* @param task MASDataTask object that was obtained as a result of invoking a request using the API invoke:taksBlock:completion:
*/

+ (void)cancelRequest:(nonnull MASDataTask*)task error:(NSError*_Nullable*_Nullable)error;


/**
* API to cancel all the pending requests in the queue.
* This is a best effort cancel and uses the underlying cancel functionality of iOS.
* This means there could be scenarios where the request has already been complete and the response is received. In such cases calling cancel has no real meaning.
* All the taks that are pending and not finished yet will be cancelled. There is no guarantee for a callback with error for all the requests.
* Use this when you are sure to cancel all the existing requests and do not really care about the outcome. For example, User moved away from the flow and does not really need any response from earlier tasks.
*/
+ (void)cancelAllRequests;

///--------------------------------------
/// @name JWT Signing
///--------------------------------------
Expand Down
Loading