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/09/17 13:05:05 UTC
[04/11] incubator-milagro-mfa-sdk-ios git commit: Implement
GetSessionId and Delete User
Implement GetSessionId and Delete User
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/d335af0f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/tree/d335af0f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/diff/d335af0f
Branch: refs/heads/master
Commit: d335af0fd3752326091881ff5c044544accf681e
Parents: df94497
Author: georgi.georgiev <ge...@certivox.com>
Authored: Tue Apr 26 15:28:35 2016 +0300
Committer: georgi.georgiev <ge...@certivox.com>
Committed: Thu Apr 28 09:44:42 2016 +0300
----------------------------------------------------------------------
MPinSDK/MPinSDK.xcodeproj/project.pbxproj | 6 ++++++
MPinSDK/MPinSDK/SessionDetails.h | 16 +++++++++++++++
MPinSDK/MPinSDK/SessionDetails.m | 23 ++++++++++++++++++++++
mpin-sdk-core | 2 +-
src/MPin.h | 3 ++-
src/MPin.mm | 27 ++++++++++++++++----------
6 files changed, 65 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/d335af0f/MPinSDK/MPinSDK.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/MPinSDK/MPinSDK.xcodeproj/project.pbxproj b/MPinSDK/MPinSDK.xcodeproj/project.pbxproj
index f78ab3f..98bba91 100644
--- a/MPinSDK/MPinSDK.xcodeproj/project.pbxproj
+++ b/MPinSDK/MPinSDK.xcodeproj/project.pbxproj
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
FE49FF9C1A1A3C2D000030A4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FE49FF9B1A1A3C2D000030A4 /* Foundation.framework */; };
+ FE7C75FC1CCF8D5B003AEB27 /* SessionDetails.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7C75FB1CCF8D5B003AEB27 /* SessionDetails.m */; };
FE991F061C5F66540014F23E /* Context.mm in Sources */ = {isa = PBXBuildFile; fileRef = FE991EF61C5F66540014F23E /* Context.mm */; };
FE991F071C5F66540014F23E /* HTTPConnector.mm in Sources */ = {isa = PBXBuildFile; fileRef = FE991EFA1C5F66540014F23E /* HTTPConnector.mm */; };
FE991F081C5F66540014F23E /* MPin.mm in Sources */ = {isa = PBXBuildFile; fileRef = FE991EFD1C5F66540014F23E /* MPin.mm */; };
@@ -64,6 +65,8 @@
FE49FF9B1A1A3C2D000030A4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
FE49FF9F1A1A3C2D000030A4 /* MPinSDK-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MPinSDK-Prefix.pch"; sourceTree = "<group>"; };
FE49FFAC1A1A3C2D000030A4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
+ FE7C75FA1CCF8D5B003AEB27 /* SessionDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionDetails.h; sourceTree = "<group>"; };
+ FE7C75FB1CCF8D5B003AEB27 /* SessionDetails.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SessionDetails.m; sourceTree = "<group>"; };
FE991EF51C5F66540014F23E /* Context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Context.h; path = ../../src/Context.h; sourceTree = "<group>"; };
FE991EF61C5F66540014F23E /* Context.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Context.mm; path = ../../src/Context.mm; sourceTree = "<group>"; };
FE991EF71C5F66540014F23E /* def.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = def.h; path = ../../src/def.h; sourceTree = "<group>"; };
@@ -178,6 +181,8 @@
FE991EFB1C5F66540014F23E /* IUser.h */,
FE991EFC1C5F66540014F23E /* MPin.h */,
FE991EFD1C5F66540014F23E /* MPin.mm */,
+ FE7C75FA1CCF8D5B003AEB27 /* SessionDetails.h */,
+ FE7C75FB1CCF8D5B003AEB27 /* SessionDetails.m */,
FE991EFE1C5F66540014F23E /* MpinStatus.h */,
FE991EFF1C5F66540014F23E /* MpinStatus.m */,
FE991F001C5F66540014F23E /* OTP.h */,
@@ -337,6 +342,7 @@
FE991F0A1C5F66540014F23E /* OTP.m in Sources */,
FE991F071C5F66540014F23E /* HTTPConnector.mm in Sources */,
FED0EE121C68C984001AB531 /* pair.c in Sources */,
+ FE7C75FC1CCF8D5B003AEB27 /* SessionDetails.m in Sources */,
FED0EE131C68C984001AB531 /* rand.c in Sources */,
FED0EE061C68C984001AB531 /* big.c in Sources */,
FED0EE141C68C984001AB531 /* rom.c in Sources */,
http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/d335af0f/MPinSDK/MPinSDK/SessionDetails.h
----------------------------------------------------------------------
diff --git a/MPinSDK/MPinSDK/SessionDetails.h b/MPinSDK/MPinSDK/SessionDetails.h
new file mode 100644
index 0000000..f19b30b
--- /dev/null
+++ b/MPinSDK/MPinSDK/SessionDetails.h
@@ -0,0 +1,16 @@
+//
+// SessionDetails.h
+// MPinSDK
+//
+// Created by Georgi Georgiev on 4/26/16.
+// Copyright � 2016 Certivox. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface SessionDetails : NSObject
+@property (nonatomic, retain) NSString * prerollId;
+@property (nonatomic, retain) NSString * appName;
+@property (nonatomic, retain) NSString * appIconUrl;
+- (id) initWith:(NSString * ) prerollId appName:(NSString *) appName appIconUrl:(NSString *) appIconUrl;
+@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/d335af0f/MPinSDK/MPinSDK/SessionDetails.m
----------------------------------------------------------------------
diff --git a/MPinSDK/MPinSDK/SessionDetails.m b/MPinSDK/MPinSDK/SessionDetails.m
new file mode 100644
index 0000000..b5cc0f6
--- /dev/null
+++ b/MPinSDK/MPinSDK/SessionDetails.m
@@ -0,0 +1,23 @@
+//
+// SessionDetails.m
+// MPinSDK
+//
+// Created by Georgi Georgiev on 4/26/16.
+// Copyright � 2016 Certivox. All rights reserved.
+//
+
+#import "SessionDetails.h"
+
+@implementation SessionDetails
+
+- (id) initWith:(NSString * ) prerollId appName:(NSString *) appName appIconUrl:(NSString *) appIconUrl {
+ self = [super init];
+ if (self) {
+ self.prerollId = prerollId;
+ self.appName = appName;
+ self.appIconUrl = appIconUrl;
+ }
+ return self;
+}
+
+@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/d335af0f/mpin-sdk-core
----------------------------------------------------------------------
diff --git a/mpin-sdk-core b/mpin-sdk-core
index acd0530..ac6536c 160000
--- a/mpin-sdk-core
+++ b/mpin-sdk-core
@@ -1 +1 @@
-Subproject commit acd0530bc597f27c93ebeda3059107f553b955a0
+Subproject commit ac6536c47bbb123fcafa83ad3dad034b60a92a3c
http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/d335af0f/src/MPin.h
----------------------------------------------------------------------
diff --git a/src/MPin.h b/src/MPin.h
index 0283959..e932d5d 100644
--- a/src/MPin.h
+++ b/src/MPin.h
@@ -21,6 +21,7 @@
#import "IUser.h"
#import "MpinStatus.h"
#import "OTP.h"
+#import "SessionDetails.h"
@interface MPin : NSObject
@@ -58,7 +59,7 @@
+ (NSMutableArray*)listUsers;
+ (NSMutableArray*) listUsers:( NSString *) backendURL;
+ (NSMutableArray*) listBackends;
-+ (NSString *) getPrerollUserId:(NSString *) accessCode;
++ (SessionDetails *) GetSessionDetails:(NSString *) accessCode;
+ ( id<IUser> ) getIUserById:(NSString *) userId;
+ (void) DeleteUser:(const id<IUser>)user;
http://git-wip-us.apache.org/repos/asf/incubator-milagro-mfa-sdk-ios/blob/d335af0f/src/MPin.mm
----------------------------------------------------------------------
diff --git a/src/MPin.mm b/src/MPin.mm
index 328b148..28225d4 100644
--- a/src/MPin.mm
+++ b/src/MPin.mm
@@ -98,12 +98,6 @@ typedef sdk_non_tee::Context Context;
return [[User alloc] initWith:userPtr];
}
-+(void) DeleteUser:(const id<IUser>) user {
- [lock lock];
- mpin.DeleteUser([((User *) user) getUserPtr]);
- [lock unlock];
-}
-
+ (MpinStatus*) StartRegistration:(const id<IUser>) user {
return [MPin StartRegistration:user activateCode:@"" userData:@""];
}
@@ -242,11 +236,18 @@ typedef sdk_non_tee::Context Context;
return users;
}
-+ (NSString *) getPrerollUserId:(NSString *) accessCode {
++ (SessionDetails *) GetSessionDetails:(NSString *) accessCode {
[lock lock];
- String value = mpin.GetPrerollUserId([accessCode UTF8String]);
+ MPinSDK::SessionDetails sd;
+ Status s = mpin.GetSessionDetails([accessCode UTF8String] , sd);
[lock unlock];
- return [NSString stringWithUTF8String:value.c_str()];
+
+ if (s.GetStatusCode() != Status::Code::OK)
+ return nil;
+
+ return [[SessionDetails alloc] initWith:[NSString stringWithUTF8String:sd.prerollId.c_str()]
+ appName:[NSString stringWithUTF8String:sd.appName.c_str()]
+ appIconUrl:[NSString stringWithUTF8String:sd.appIconUrl.c_str()]];
}
+ ( id<IUser> ) getIUserById:(NSString *) userId {
@@ -284,4 +285,10 @@ typedef sdk_non_tee::Context Context;
return backends;
}
-@end
++ (void) DeleteUser:(const id<IUser>) user {
+ [lock lock];
+ mpin.DeleteUser([((User *) user) getUserPtr]);
+ [lock unlock];
+}
+
+@end
\ No newline at end of file