You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@milagro.apache.org by sa...@apache.org on 2016/11/01 10:09:10 UTC

[1/5] incubator-milagro-mfa-sdk-ios git commit: Added capability to init SDK with custom HTTP Headers

Repository: incubator-milagro-mfa-sdk-ios
Updated Branches:
  refs/heads/master 4b4c745b4 -> e8ae71d4a


Added capability to init SDK with custom HTTP Headers


Project: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/commit/57c294e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/tree/57c294e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/diff/57c294e4

Branch: refs/heads/master
Commit: 57c294e4c9c3b2dafa27a36bfc10cd0f390bc2ec
Parents: 4b4c745
Author: Tihomir Ganev <ti...@imac.local>
Authored: Mon Oct 31 14:57:10 2016 +0200
Committer: Tihomir Ganev <ti...@iMac.local>
Committed: Mon Oct 31 14:57:10 2016 +0200

----------------------------------------------------------------------
 MPinSDK/MPinSDK.xcodeproj/project.pbxproj | 10 +++++-----
 src/HTTPConnector.mm                      | 25 +++++++++++++++++++++----
 src/MPin.h                                |  1 +
 src/MPin.mm                               | 20 +++++++++++++++++++-
 4 files changed, 46 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/57c294e4/MPinSDK/MPinSDK.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/MPinSDK/MPinSDK.xcodeproj/project.pbxproj b/MPinSDK/MPinSDK.xcodeproj/project.pbxproj
index 6b28fc6..5fb75e9 100644
--- a/MPinSDK/MPinSDK.xcodeproj/project.pbxproj
+++ b/MPinSDK/MPinSDK.xcodeproj/project.pbxproj
@@ -394,7 +394,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 7.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				SDKROOT = iphoneos;
 				USER_HEADER_SEARCH_PATHS = "../../mpin-sdk-core/ext/cvshared/cpp/include/**";
 				VALIDATE_PRODUCT = YES;
@@ -440,7 +440,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 7.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				SDKROOT = iphoneos;
 				USER_HEADER_SEARCH_PATHS = "../../mpin-sdk-core/ext/cvshared/cpp/include/**";
 				VALIDATE_PRODUCT = YES;
@@ -486,7 +486,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 7.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				SDKROOT = iphoneos;
 				USER_HEADER_SEARCH_PATHS = "../../mpin-sdk-core/ext/cvshared/cpp/include/**";
 				VALIDATE_PRODUCT = YES;
@@ -538,7 +538,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 7.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
 				USER_HEADER_SEARCH_PATHS = "../../mpin-sdk-core/ext/cvshared/cpp/include/**";
@@ -570,7 +570,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 7.1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				SDKROOT = iphoneos;
 				USER_HEADER_SEARCH_PATHS = "../../mpin-sdk-core/ext/cvshared/cpp/include/**";
 				VALIDATE_PRODUCT = YES;

http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/57c294e4/src/HTTPConnector.mm
----------------------------------------------------------------------
diff --git a/src/HTTPConnector.mm b/src/HTTPConnector.mm
index 7acb724..509bbc9 100644
--- a/src/HTTPConnector.mm
+++ b/src/HTTPConnector.mm
@@ -94,14 +94,30 @@ namespace net {
 
         [request setTimeoutInterval:constIntTimeoutInterval];
         
-        if(!m_requestHeaders.empty()) {
-            for (StringMap::const_iterator it=m_requestHeaders.begin(); it!=m_requestHeaders.end(); ++it) {
-                [request addValue:[NSString stringWithUTF8String:it->second.c_str()] forHTTPHeaderField:[NSString stringWithUTF8String:it->first.c_str()]];
+        NSDictionary *dictionary = [request allHTTPHeaderFields];
+        
+        if(!m_requestHeaders.empty())
+        {
+            for (StringMap::const_iterator it=m_requestHeaders.begin(); it!=m_requestHeaders.end(); ++it)
+            {
+                NSString *strValue = [NSString stringWithUTF8String:it->second.c_str()];
+                NSString *strKey   = [NSString stringWithUTF8String:it->first.c_str()];
+                
+                if ([[dictionary allKeys] containsObject:strKey])
+                {
+                    [request setValue:strValue forHTTPHeaderField:strKey];
+                }
+                else
+                {
+                    [request addValue:strValue forHTTPHeaderField:strKey];
+                }
             }
         }
         
         [request addValue:@"ios" forHTTPHeaderField:@"X-MIRACL-OS-Class"];
         
+        /*
+        // Deprecated Code Starting Here
         NSDictionary *dictInfo = [[NSBundle mainBundle] infoDictionary];
         NSString *strBundleID       = dictInfo[@"CFBundleIdentifier"];
         NSString *strAppVersion     = dictInfo[@"CFBundleShortVersionString"];
@@ -111,7 +127,8 @@ namespace net {
         NSString *strUserAgent = [NSString stringWithFormat:@"%@/%@ (ios/%@) build/%@",strBundleID,strAppVersion,strOSVersion, strBuildNumber];
         
         [request setValue:strUserAgent forHTTPHeaderField:@"User-Agent"];
-
+        // Deprecated Code Ends Here
+         */
         
         if(!m_bodyData.empty()) {
             request.HTTPBody =  [[NSString stringWithUTF8String:m_bodyData.c_str()] dataUsingEncoding:NSUTF8StringEncoding];

http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/57c294e4/src/MPin.h
----------------------------------------------------------------------
diff --git a/src/MPin.h b/src/MPin.h
index 9a9142d..395d22b 100644
--- a/src/MPin.h
+++ b/src/MPin.h
@@ -26,6 +26,7 @@
 @interface MPin : NSObject
 
 + (void) initSDK;
++ (void) initSDKWithUserAgent:(NSDictionary *)dictHeaders;
 + (MpinStatus*) TestBackend:(const NSString*)url;
 + (MpinStatus*) SetBackend:(const NSString*)url;
 + (MpinStatus*) TestBackend:(const NSString*)url rpsPrefix:(NSString*)rpsPrefix;

http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/57c294e4/src/MPin.mm
----------------------------------------------------------------------
diff --git a/src/MPin.mm b/src/MPin.mm
index 28225d4..91e8804 100644
--- a/src/MPin.mm
+++ b/src/MPin.mm
@@ -51,6 +51,24 @@ typedef sdk_non_tee::Context Context;
     isInitialized = true;
 }
 
++ (void) initSDKWithUserAgent:(NSDictionary *)dictHeaders{
+    
+    if (isInitialized) return;
+
+    StringMap sm;
+    StringMap sm_CustomHeaders;
+    
+    for( id headerName in dictHeaders)
+    {
+        sm_CustomHeaders.Put( [headerName UTF8String], [dictHeaders[headerName] UTF8String] );
+    }
+    
+    [lock lock];
+    mpin.Init(sm, sdk_non_tee::Context::Instance(), sm_CustomHeaders);
+    [lock unlock];
+    isInitialized = true;
+}
+
 +(MpinStatus *) TestBackend:(const NSString * ) url {
     [lock lock];
     Status s = mpin.TestBackend((url == nil)?(""):([url UTF8String]));
@@ -291,4 +309,4 @@ typedef sdk_non_tee::Context Context;
     [lock unlock];
 }
 
-@end
\ No newline at end of file
+@end


[2/5] incubator-milagro-mfa-sdk-ios git commit: init method name changed to be more meaningful

Posted by sa...@apache.org.
init method name changed to be more meaningful


Project: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/commit/742285c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/tree/742285c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/diff/742285c7

Branch: refs/heads/master
Commit: 742285c7e22078f4b41fc915fcf5d224e5b1d35e
Parents: 57c294e
Author: Tihomir Ganev <ti...@imac.local>
Authored: Mon Oct 31 15:46:52 2016 +0200
Committer: Tihomir Ganev <ti...@iMac.local>
Committed: Mon Oct 31 15:46:52 2016 +0200

----------------------------------------------------------------------
 src/MPin.h  | 2 +-
 src/MPin.mm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/742285c7/src/MPin.h
----------------------------------------------------------------------
diff --git a/src/MPin.h b/src/MPin.h
index 395d22b..c1562ec 100644
--- a/src/MPin.h
+++ b/src/MPin.h
@@ -26,7 +26,7 @@
 @interface MPin : NSObject
 
 + (void) initSDK;
-+ (void) initSDKWithUserAgent:(NSDictionary *)dictHeaders;
++ (void) initSDKWithHeaders:(NSDictionary *)dictHeaders;
 + (MpinStatus*) TestBackend:(const NSString*)url;
 + (MpinStatus*) SetBackend:(const NSString*)url;
 + (MpinStatus*) TestBackend:(const NSString*)url rpsPrefix:(NSString*)rpsPrefix;

http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/742285c7/src/MPin.mm
----------------------------------------------------------------------
diff --git a/src/MPin.mm b/src/MPin.mm
index 91e8804..974947d 100644
--- a/src/MPin.mm
+++ b/src/MPin.mm
@@ -51,7 +51,7 @@ typedef sdk_non_tee::Context Context;
     isInitialized = true;
 }
 
-+ (void) initSDKWithUserAgent:(NSDictionary *)dictHeaders{
++ (void) initSDKWithHeaders:(NSDictionary *)dictHeaders{
     
     if (isInitialized) return;
 


[3/5] incubator-milagro-mfa-sdk-ios git commit: Tiny change in allocation of StringMap

Posted by sa...@apache.org.
Tiny change in allocation of StringMap


Project: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/commit/d2a6f44d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/tree/d2a6f44d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/diff/d2a6f44d

Branch: refs/heads/master
Commit: d2a6f44d3ed971058f7c2be9efe35a0da6c28277
Parents: 742285c
Author: Tihomir Ganev <ti...@imac.local>
Authored: Tue Nov 1 11:26:56 2016 +0200
Committer: Tihomir Ganev <ti...@iMac.local>
Committed: Tue Nov 1 11:26:56 2016 +0200

----------------------------------------------------------------------
 src/MPin.mm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/d2a6f44d/src/MPin.mm
----------------------------------------------------------------------
diff --git a/src/MPin.mm b/src/MPin.mm
index 974947d..18cec88 100644
--- a/src/MPin.mm
+++ b/src/MPin.mm
@@ -43,11 +43,13 @@ typedef sdk_non_tee::Context Context;
 }
 
 +(void) initSDK {
+    
     if (isInitialized) return;
-    StringMap sm;
+    
     [lock lock];
-    mpin.Init(sm, sdk_non_tee::Context::Instance());
+    mpin.Init(StringMap(), sdk_non_tee::Context::Instance());
     [lock unlock];
+    
     isInitialized = true;
 }
 
@@ -55,7 +57,6 @@ typedef sdk_non_tee::Context Context;
     
     if (isInitialized) return;
 
-    StringMap sm;
     StringMap sm_CustomHeaders;
     
     for( id headerName in dictHeaders)
@@ -64,8 +65,9 @@ typedef sdk_non_tee::Context Context;
     }
     
     [lock lock];
-    mpin.Init(sm, sdk_non_tee::Context::Instance(), sm_CustomHeaders);
+    mpin.Init(StringMap(), sdk_non_tee::Context::Instance(), sm_CustomHeaders);
     [lock unlock];
+    
     isInitialized = true;
 }
 


[5/5] incubator-milagro-mfa-sdk-ios git commit: Update documentation with the `initSDKWithHeaders` method

Posted by sa...@apache.org.
Update documentation with the `initSDKWithHeaders` method


Project: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/commit/e8ae71d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/tree/e8ae71d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/diff/e8ae71d4

Branch: refs/heads/master
Commit: e8ae71d4a5841ca7fbdd3824aa6a73582d77d1a9
Parents: 00a14b0
Author: Simeon Aladjem <si...@miracl.com>
Authored: Tue Nov 1 12:08:35 2016 +0200
Committer: Simeon Aladjem <si...@miracl.com>
Committed: Tue Nov 1 12:08:35 2016 +0200

----------------------------------------------------------------------
 README.md | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/e8ae71d4/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 2a7a9a0..9d31f5b 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,10 @@ typedef NS_ENUM(NSInteger, MPinStatus) {
 ##### `(void) initSDK;`
 This method constructs/initializes the SDK object.
 
+##### `(void) initSDKWithHeaders: (NSDictionary*) dictHeaders;`
+This method constructs/initializes the SDK object.
+The `dictHeaders` parameter allows the caller to pass additional dictionary of custom headers, which will be added to any HTTP request that the SDK executes.
+
 **Note that after this initialization the SDK will not be ready for usage until `SetBackend` is called with a valid _Server URL_.**
 
 ##### `(MpinStatus*) TestBackend: (const NSString*) url;`


[4/5] incubator-milagro-mfa-sdk-ios git commit: Merge pull request #12 in MM/mpin-sdk-ios from UserAgentFix to master

Posted by sa...@apache.org.
Merge pull request #12 in MM/mpin-sdk-ios from UserAgentFix to master

* commit 'd2a6f44d3ed971058f7c2be9efe35a0da6c28277':
  Tiny change in allocation of StringMap
  init method name changed to be more meaningful
  Added capability to init SDK with custom HTTP Headers


Project: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/commit/00a14b0b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/tree/00a14b0b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/diff/00a14b0b

Branch: refs/heads/master
Commit: 00a14b0b115fe44efc426682f89d23be44c935c1
Parents: 4b4c745 d2a6f44
Author: Simeon Aladjem <si...@certivox.com>
Authored: Tue Nov 1 11:00:42 2016 +0100
Committer: Simeon Aladjem <si...@certivox.com>
Committed: Tue Nov 1 11:00:42 2016 +0100

----------------------------------------------------------------------
 MPinSDK/MPinSDK.xcodeproj/project.pbxproj | 10 +++++-----
 src/HTTPConnector.mm                      | 25 +++++++++++++++++++++----
 src/MPin.h                                |  1 +
 src/MPin.mm                               | 26 +++++++++++++++++++++++---
 4 files changed, 50 insertions(+), 12 deletions(-)
----------------------------------------------------------------------