IPUser
@objc
open class IPUser : NSObject, Codable
Class the represents an IAMPASS User. Instances of this class contain the information required to communicate with IAMPASS on behalf the of the device user. The client applicaton is responsible for storing the IPUser data for the user accounts registered with their app. IPUser data can be serialized as JSON and store/read from a secure location, for example the device key chain.
-
True if IAMPASS needs to collect training data for this device. Client applications should check this value after registering or updating devices and if it it True perform device training.
Declaration
Swift
open var training_required: Bool { get }
-
Prototype for success completion block
Declaration
Swift
public typealias device_success_proc = (_ identifier: Any, _ device: IPUser) -> Void
Parameters
identifier
A client application provided identifier for the user account. This is same value passed to register device.
device
The registered or updated device.
-
Prototype for failure completion block
Declaration
Swift
public typealias device_failure_proc = (_ identifier: Any, _ error: Error) -> Void
Parameters
identifier
A client application provided identifier for the user account. This is same value passed to register device.
error
The failure reason.
-
Registers this physical device for the user and account described in the registration link. Information about the current device is collected and posted to the registration link. The following information is collected: device name os version application version application identifier active connect version (version of this framework) On successful completion the client application should check the
training_required
property of the device and perform appropriate training.Declaration
Swift
public static func registerDevice( identifier: Any, registration_link: URL, notification_token: String, success: @escaping device_success_proc, failure : @escaping device_failure_proc)
Parameters
identifier
A value use to identify the device to your application.
registration_link
A URL generated by IAMPASS to connect a physical device to a user.
notification_token
The APNS notification token for this physical device obtained by registering for Push Notifications. You can pass a dummy notification token for this parameter if your user has chosen not to allow push notifications. Dummy notification tokens MUST start with the ‘*’ character.
success
The code block called when registration succeeds. The identifier parameter will be the same and the identifier parameter passed to this method. The device parameter will be the new device data. The client application should store this data.
failure
The code block called when the registration failed. The identifier parameter will be the same and the identifier parameter passed to this method. The error parameter will describe the failure reason, this can be any system error or an instance of ACError.
-
Unregisters a device. If the method succeeds the success block is called. The caller should remove the IPUser from application storage as the device data is no longer valid. If the method fails the failure block is called. The caller can delete the store data, but the user may still have a registered device. If the failure block is called with an instance of ACError with kind == Device_Not_Found, the device may not exist. It is best practice to use
ManagementAPI.has_registered_mobile_device
to be sure the device does not exist before deleting application data.Declaration
Swift
open func unregister(identifier: Any, success: @escaping (_ identifier: Any) -> Void, failure: @escaping (_ identifier: Any, _ error: Error) -> Void)
Parameters
identifier
A client application provided identifier for the device.
success
Code block to execute when the device is unregistered.
failure
Code block to execute when the device fails to unregister, The error parameter indicates the failure reason.
-
Calls the IAMPASS API to update this device. This method updates this instance. This method should be called for all stored IPUsers when the application starts or any event that changes the Push Notification status or token change. On successful completion the client application should check the
training_required
property of the device and perform appropriate training.Declaration
Swift
open func update( identifier: Any, notification_token: String, success: @escaping( _ identifier: Any, _ user: IPUser) -> Void, failure : @escaping(_ identifier:Any,_ error: Error) -> Void)
Parameters
identifier
An identifier used by the client application to identify the device
notification_token
The APNS notification token for the device. If the user has disable notifications you should pass a string that starts with a ‘*’
success
Code block that is called when the request succeeds. The device parameter is self
failure
Code block to call when the request fails. The error parameter can be an ACError with the kind and message describing the error or a generic Swift error.