Classes
The following classes are available globally.
-
AuthorizationHandler to perform authorization against the PredixMobile authorization service.
Given a valid authenticated user, this class interacts with the Predix Mobile session service to initialize a session, and return user information.
See moreDeclaration
Swift
open class PredixMobileAuthorizationHandler: AuthorizationHandler
-
See moreRefreshAuthenticationHandler
subclass that handles standard predix.io UAA service refresh token authenticationDeclaration
Swift
open class UAARefreshAuthenticationHandler: RefreshAuthenticationHandler
-
AuthenticationManager manages the overall authentication, authorization, and deauthentication process.
It does this by determining what type of authentication is needed based on the current system state and the provided configuration, and then passes detailed authentication tasks to AuthenticationHandler modules. Each implementer of the AuthenticationHandler protocol should implement one type of authentication.
In this way, based on configuration, AuthenticationManager will automatically handle online and offline authentication and if so configured will utilize Touch ID for subsequent authentications after an initial online login was performed successfully.
Example:*
See more// First, create and populate our configuration var config = AuthenticationManagerConfiguration() let url = URL(string: "https://auth.myserver.com") config.baseURL = url config.clientId = "my_oauth_client_id" config.clientSecret = "my_oauth_client_secret" config.useTouchID = true // TouchId for refresh and offline authentication is disabled by default. // Next, create an AuthenticationManager object with the configuration let manager = AuthenticationManager(configuration: config) // Assign an OnlineAuthenticationHandler or subclass. In this case, UAABrowserAuthenticationHandler provides support for browser-based UAA login let onlineHandler = UAABrowserAuthenticationHandler(redirectURI: "predixmobile://foobar") // Assign a refresh handler to allow for refreshing a token without having to do a full login again onlineHandler.refreshAuthenticationHandler = UAARefreshAuthenticationHandler() // Set delegates as needed onlineHandler.authenticationBrowserDelegate = self // Assign the OnlineAuthenticationHandler to the manager manager.onlineAuthenticationHandler = onlineHandler // Similarly, assign an OfflineAuthenticationHandler for offline authentication support manager.offlineAuthenticationHandler = OfflineAuthenticationHandler() // And assign an AuthorizationHandler class for calling the authorization service after authenticating. manager.authorizationHandler = PredixMobileAuthorizationHandler() // Then call authenticate. The completionHandler will be called when the authentication process finishes. manager.authenticate { (status) in print("Authentication Status: \(status)") }
Declaration
Swift
public class AuthenticationManager
-
Wrapper object used for returning the wait state of the UI. Encapsulates both the WaitState enumeration, and the optional string message.
See moreDeclaration
Swift
@objc open class WaitStateReturn: NSObject
-
OnlineAuthenticationHandler
subclass for handling service-call based based (non-browser) online authentication.Handles making a request to the backend for authentication, and parsing the results.
See moreDeclaration
Swift
open class ServiceBasedAuthenticationHandler: OnlineAuthenticationHandler, CallAuthenticationServiceProtocol
-
Supports hybrid webapp-based offline login
See moreDeclaration
Swift
public class HybridOfflineAuthenticationHandler: OfflineAuthenticationHandler
-
Allows an application to add monitor data that can be stored and transmitted once a user is online. The MobileMonitor is a non-intrusive and non-blocking log collector that can be configured to be more or less aggressive with monitoring logs. all items are processed in a serial queue on a background thread. By default, the monitor will trace database events and report their status with a timestamp for debugging time critical operations. It will also attempt to detect document conflicts which can be a cause for concern for applications. Additionally, applications can add their own monitoring and bundle it with the monitor items that are included by default. This allows applications to dynamically collect logs when needed to help remotely route cause issues without needed to send a new application to the device. The monitor has been optimized to be non-intrusive to the running application, however users may still experience some lag if the monitor is set to aggressively collect, save and transmit logs.
See moreDeclaration
Swift
public class MobileMonitor
-
A specialized AuthenticationHandler that works with an associated
See moreBrowserBasedAuthenticationHandler
to exchange a UAA authorization code for authentication and refresh tokens.Declaration
Swift
public class UAACodeExchangeAuthenticationHandler: AuthenticationHandler
-
Declaration
Swift
public class ReadKeychainCommand: KeychainCommand
-
Declaration
Swift
public class WriteKeychainCommand: KeychainCommand
-
KeychainCommand base class for reading and writing values to/from the keychain
See moreDeclaration
Swift
public class KeychainCommand
-
Static class of elements Predix Mobile SDK consumers can use to adjust to configure aspects of the SDK.
See moreDeclaration
Swift
@objc public class PredixMobilityConfiguration: NSObject
-
Uses SFAuthenticationSession (available in iOS 11) to handle authentication, then uses
See moreUAACodeExchangeAuthenticationHandler
to exchange the retrieved authorization code for authentication and refresh tokens.Declaration
Swift
public class SFAuthenticationSessionHandler: OnlineAuthenticationHandler
-
Base class for all AuthenticationHandlers.
Provides common functions that all AuthenticationHandlers share.
See moreDeclaration
Swift
open class AuthenticationHandler
-
Base class for all refresh authentication handlers used by an
OnlineAuthenticationHandler
Processes Oauth2 refresh-based authentication, where a refresh token is exchanged for an active authentication token with an authentication provider.
Intended to allow for secure biometric or device passcode based authentication scenarios.
In the expected process, the
See moreOnlineAuthenticationHandler.authenticationResponsePayload
property will contain a refresh token. This token is then used by this handler during the next authentication request to refresh the authentication without needing the users credentials.Declaration
Swift
open class RefreshAuthenticationHandler: AuthenticationHandler, CallAuthenticationServiceProtocol
-
Used to create full text search database views.
example:
PredixMobilityConfiguration.appendDataViewDefinition("views/searchtext", version: "1") { (properties: [String : Any], emit: (Any, Any?) -> Void) -> Void in if let body = properties["body"] as? String { emit(FullTextSearch.createKey(body), nil) } }
Declaration
Swift
@objc open class FullTextSearch: NSObject
-
Stores user data, populated during the authentication process.
See moreDeclaration
Swift
public class UserManager
-
Command class encapsulating a minimum Command
See moreDeclaration
Swift
public class Command: CommandContents
-
Command subclass that contains additional properties after the Command has been committed.
See moreDeclaration
Swift
public class CommandResponse: Command, CommandRecord, CommandDocumentData
-
Predix Mobile SDK main manager class
Controls the interface between the container application and the SDK.
See moreDeclaration
Swift
@objc public class PredixMobilityManager: NSObject
-
BrowserBasedAuthenticationHandler
subclass that handles standard predix.io UAA browser-based login page authentication.Uses the UAA
See moreauthorization code grant
mechanism, which then usesUAACodeExchangeAuthenticationHandler
to exchange that authorization code for authentication and refresh tokens.Declaration
Swift
open class UAABrowserAuthenticationHandler: BrowserBasedAuthenticationHandler
-
Retrieves
See morePredixMobileServerInformation
from a given Predix Mobile server endpointDeclaration
Swift
public class PredixMobileServerInformationFetcher
-
Database interaction class. Controls setup of replication, access to documents, manipulation of attachments, etc.
See moreDeclaration
Swift
public class DatabaseManager: DatabaseManagerProtocol
-
Provides Logging support for the SDK.
On iOS 9 and below and macOS El Capitan and below this class will use the Apple NSLog-style logs.
When running in iOS 10+ and macOS Sierra+ this class will use the Apple Unified Logging API
See also
SeeAlso:
Declaration
Swift
@objc open class Logger: NSObject, LoggerProtocol
-
Declaration
Swift
open class OfflineAuthenticationHandler: AuthenticationHandler
-
AuthorizationHandler to extract authorization data from the UAA oAuth token
See moreDeclaration
Swift
open class UAAAuthorizationHandler: AuthorizationHandler
-
Base class for all online authentication handlers
Processes online authentication, and allows for authentication refresh capabilities.
See moreDeclaration
Swift
open class OnlineAuthenticationHandler: AuthenticationHandler
-
The ServiceRouter controls what services are available or unavailable and processes service requests.
When a service is
registered
it is made available to process requests. When it isunregistered
it is no longer available to service requests.All services registered must have a unique serviceIdentifier string.
Attempts to register a service with a serviceIdentifier string that is already registered will not be successful.
Declaration
Swift
@objc public class ServiceRouter: NSObject, ServiceRouterProtocol
-
OnlineAuthenticationHandler
subclass for handling browser-based based online authentication.Handles displaying an authentication web page, intercepting an Oauth2 redirect, and parsing the results.
See moreDeclaration
Swift
open class BrowserBasedAuthenticationHandler: OnlineAuthenticationHandler
-
Provides the ability to open a URL on device external to app.
URLs may launch different apps on the device, for example:
The URL
mailto://someone@example.com?Subject=Hello%20again
would open the mail app.The URL
tel:1-800-555-1212
would open the phone app, and initiate a phone call.The URL
https://www.google.com
would open the Safari app.
Declaration
Swift
public class OpenURLService: NSObject, ServiceProtocol
-
Allows an application developer to provide mock data responses for URLSession and other types of network request classes (UIWebView for example).
The MockNetworkDataManager works with mock data providers to determine if a requested URL should return real network data or mock network data.
By default the MockNetworkDataManager uses a default data provider that works with a resource bundle and plist to determine if a requested URL should return mock data. Here is an example of how the default provider works:
In a project define a MockData.bundle resource bundle, inside that bundle it should contain all of the contents you need to mock a network response for a request. The bundle should also include a DataMapping.plist file.
Example: <?xml version=
1.0
encoding=UTF-8
?> <!DOCTYPE plist PUBLIC-//Apple//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd
>https://apple.com dataFilename mockData.json requests httpMethod GET headerFields a b response headerFields a b httpVersion 1.1 statusCode 200 httpMethod POST Alternatively you can define a simple response structure, this will return the response for ANY requests sent for the given endpoint
<?xml version=
1.0
encoding=UTF-8
?> <!DOCTYPE plist PUBLIC-//Apple//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd
>https://simple.com dataFilename mockData.json response headerFields a b httpVersion 1.1 statusCode 200 The data is loaded from disk as raw Data using the contents of file as the data response. This means the default provider should be able to work with most file types (JSON, text, images, video, etc.)
See moreDeclaration
Swift
open class MockNetworkDataManager: NSObject
-
See moreServiceBasedAuthenticationHandler
subclass that handles standard predix.io UAA service password grant authenticationDeclaration
Swift
open class UAAServiceAuthenticationHandler: ServiceBasedAuthenticationHandler
-
Handles methods for application lifecycle events, local and remote notifications.
If PredixMobilityConfiguration.automaticallyListenForApplicationStateEvents is true, the SDK will automatically handle application lifecycle events, however local and remote notification event method calls will need to be passed to the SDK from the container app.
See moreDeclaration
Swift
public class ApplicationDelegateHandlers
-
Object to contain the result of a keychain operation.
See moreDeclaration
Swift
public class KeychainCommandResult
-
Declaration
Swift
public class ReadKeychainCommandResult: KeychainCommandResult
-
Keychain access class used for storing, retrieving and deleting values from the Apple keychain.
See moreDeclaration
Swift
public class Keychain