AttestationObserver
public class AttestationObserver
extension AttestationObserver: SAPURLSessionObserving
An observer which is responsible for obtaining the attestation token from SAP Mobile Services and adding it to each request header before being sent. The class also refreshes the token when the token expires.
SAP BTP SDK For iOS uses Apple’s DeviceCheck framework to assert the legitimacy of a particular instance of your application to SAP Mobile Services from where administrators can assess the fraud risk and eventually enforce HTTP communication for asserted devices only.
For more information on AppAttest: https://developer.apple.com/documentation/devicecheck/establishing_your_app_s_integrity
Use this observer by simply adding it to a SAPURLSession
do {
// Create an instance of `AttestationService` using the initializer.
let service = try AttestationService(sapCpmsSettingsParameters: settingsParameters,
sapUrlSession: urlSession, store: persistentStore, attestationSettings: settings)
// Create an instance of `AttestationObserver` using the service.
let observer = AttestationObserver(attestationService: service)
sapURLSession.register(observer)
} catch {
//catch error
}
-
Initializes an instance of AttestationObserver
Declaration
Swift
public init(attestationService: AttestationService)
Parameters
attestationService
An instance of AttestationService
-
Removes the data persisted during Application attestation and assertion
Declaration
Swift
public func reset()
-
Declaration
Swift
public func sapURLSession(_ session: SAPURLSession, task: SAPURLSessionTask, willSend request: URLRequest, completionHandler: @escaping (SAPURLSession.RequestDisposition) -> Void)
-
Declaration
Swift
public func sapURLSession(_ session: SAPURLSession, task: SAPURLSessionTask, didCompleteWithError error: Error?)
-
Declaration
Swift
public func sapURLSession(_ session: SAPURLSession, dataTask: SAPURLSessionTask, didReceive response: URLResponse, completionHandler: @escaping (SAPURLSession.ResponseDisposition) -> Void)