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/17 12:19:21 UTC

[1/2] incubator-milagro-mfa-sdk-core git commit: Add support for logging into the mobile app using the MFA Platform

Repository: incubator-milagro-mfa-sdk-core
Updated Branches:
  refs/heads/master 99c5a8919 -> a0352396e


Add support for logging into the mobile app using the MFA Platform

Added SetClient and FinishAuthenticationMFA functions to MPinSDK.

Closes: MAASMOB-404


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

Branch: refs/heads/master
Commit: 6d27c452942509d3a6b5b8edb0dba7db5716a7ec
Parents: 99c5a89
Author: Slav Klenov <sl...@miracl.com>
Authored: Wed Nov 16 15:07:22 2016 +0200
Committer: Slav Klenov <sl...@miracl.com>
Committed: Thu Nov 17 14:06:56 2016 +0200

----------------------------------------------------------------------
 src/mpin_sdk.cpp | 19 ++++++++++++++++++-
 src/mpin_sdk.h   |  2 ++
 src/utils.cpp    |  8 ++++++++
 src/utils.h      |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/blob/6d27c452/src/mpin_sdk.cpp
----------------------------------------------------------------------
diff --git a/src/mpin_sdk.cpp b/src/mpin_sdk.cpp
index 9077fac..cf37779 100644
--- a/src/mpin_sdk.cpp
+++ b/src/mpin_sdk.cpp
@@ -661,7 +661,7 @@ Status MPinSDK::Init(const StringMap& config, IContext* ctx, const StringMap& cu
     }
 
     m_context = ctx;
-    m_customHeaders = customHeaders;
+    m_customHeaders.PutAll(customHeaders);
 
     if(ctx->GetMPinCryptoType() == CRYPTO_NON_TEE)
     {
@@ -703,6 +703,11 @@ Status MPinSDK::Init(const StringMap& config, IContext* ctx, const StringMap& cu
     return SetBackend(backend, rpsPrefix);
 }
 
+void MPinSDK::SetClientId(const String& clientId)
+{
+    m_customHeaders["X-MIRACL-Client-ID"] = clientId;
+}
+
 void MPinSDK::Destroy()
 {
     if(!IsInitilized())
@@ -716,6 +721,8 @@ void MPinSDK::Destroy()
     m_crypto = NULL;
     m_context = NULL;
 
+    m_customHeaders.clear();
+
     m_state = NOT_INITIALIZED;
 }
 
@@ -1118,6 +1125,16 @@ Status MPinSDK::FinishAuthenticationAN(INOUT UserPtr user, const String& pin, co
     return s;
 }
 
+Status MPinSDK::FinishAuthenticationMFA(INOUT UserPtr user, const String& pin, OUT String& authzCode)
+{
+    util::JsonObject authResult;
+
+    Status s = FinishAuthenticationImpl(user, pin, "", NULL, authResult);
+
+    authzCode = authResult.GetStringParam("code");
+    return s;
+}
+
 Status MPinSDK::FinishAuthenticationImpl(INOUT UserPtr user, const String& pin, const String& accessNumber, OUT String *otp, OUT util::JsonObject& authResultData)
 {
     Status s = CheckIfBackendIsSet();

http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/blob/6d27c452/src/mpin_sdk.h
----------------------------------------------------------------------
diff --git a/src/mpin_sdk.h b/src/mpin_sdk.h
index 6785143..5d29199 100644
--- a/src/mpin_sdk.h
+++ b/src/mpin_sdk.h
@@ -241,6 +241,7 @@ public:
     ~MPinSDK();
     Status Init(const StringMap& config, IN IContext* ctx);
     Status Init(const StringMap& config, IN IContext* ctx, const StringMap& customHeaders);
+    void SetClientId(const String& clientId);
     void Destroy();
     void ClearUsers();
 
@@ -259,6 +260,7 @@ public:
     Status FinishAuthentication(INOUT UserPtr user, const String& pin, OUT String& authResultData);
     Status FinishAuthenticationOTP(INOUT UserPtr user, const String& pin, OUT OTP& otp);
     Status FinishAuthenticationAN(INOUT UserPtr user, const String& pin, const String& accessNumber);
+    Status FinishAuthenticationMFA(INOUT UserPtr user, const String& pin, OUT String& authzCode);
 
     Status GetSessionDetails(const String& accessCode, OUT SessionDetails& sessionDetails);
 

http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/blob/6d27c452/src/utils.cpp
----------------------------------------------------------------------
diff --git a/src/utils.cpp b/src/utils.cpp
index 4e70298..59a7664 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -282,6 +282,14 @@ bool StringMap::Put(const String& key, const String& value)
     return true;
 }
 
+void StringMap::PutAll(const StringMap& other)
+{
+    for (StringMap::const_iterator i = other.begin(); i != other.end(); ++i)
+    {
+        (*this)[i->first] = i->second;
+    }
+}
+
 const char * StringMap::Get(const String& key) const
 {
     const_iterator i = find(key);

http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-core/blob/6d27c452/src/utils.h
----------------------------------------------------------------------
diff --git a/src/utils.h b/src/utils.h
index 20ae803..25569fe 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -86,6 +86,7 @@ public:
     StringMap(const json::Object& object);
     json::Object ToJsonObject() const;
     bool Put(const String& key, const String& value);
+    void PutAll(const StringMap& other);
     const char * Get(const String& key) const;
 };
 


[2/2] incubator-milagro-mfa-sdk-core git commit: Merge remote-tracking branch 'miracl/master'

Posted by sa...@apache.org.
Merge remote-tracking branch 'miracl/master'


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

Branch: refs/heads/master
Commit: a0352396e1a77e5ce2dbc071ec73e15157b6b195
Parents: 99c5a89 6d27c45
Author: Simeon Aladjem <si...@miracl.com>
Authored: Thu Nov 17 14:18:50 2016 +0200
Committer: Simeon Aladjem <si...@miracl.com>
Committed: Thu Nov 17 14:18:50 2016 +0200

----------------------------------------------------------------------
 src/mpin_sdk.cpp | 19 ++++++++++++++++++-
 src/mpin_sdk.h   |  2 ++
 src/utils.cpp    |  8 ++++++++
 src/utils.h      |  1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------