//implementing UNUserNotificationCenterDelegatefunc userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void) { let userInfo = notification.request.content.userInfo if let notification = Guardian.notification(from: userInfo) { // Implement this function to display the prompt and handle user's consent/rejection. handleGuardianNotification(notification: notification) }}
不正なコードを報告
コピー
AIに質問
// at the FCM listener you receive a RemoteMessage@Overridepublic void onMessageReceived(RemoteMessage message) { Notification notification = Guardian.parseNotification(message.getData()); if (notification != null) { // you received a Guardian notification, handle it handleGuardianNotification(notification); return; } /* handle other push notifications you might be using ... */}
let device: AuthenticationDevice = // the object you obtained during the initial Guardian SDK enrollment process and stored locallyif let consentId = notification.transactionLinkingId { Guardian .consent(forDomain: {yourTenantDomain}, device: device) .fetch(consentId: consentId, notificationToken: notification.transactionToken) .start{result in switch result { case .success(let payload): // present consent details to the user case .failure(let cause): // something went wrong } }}
不正なコードを報告
コピー
AIに質問
Enrollment enrollment = // the object you obtained during the initial Guardian SDK enrollment process and stored locallyif (notification.getTransactionLinkingId() != null) { guardian .fetchConsent(notification, enrollment) .start(new Callback<Enrollment> { @Override void onSuccess(RichConsent consentDetails) { // present consent details to the user } @Override void onFailure(Throwable exception) { // something went wrong } });}
Guardian .authentication(forDomain: "{yourTenantDomain}", device: device) .allow(notification: notification) // or reject(notification: notification, withReason: "hacked") .start { result in switch result { case .success: // the auth request was successfully rejected case .failure(let cause): // something failed, check cause to see what went wrong } }
不正なコードを報告
コピー
AIに質問
guardian .allow(notification, enrollment) .execute(); // or start(new Callback<> ...)
Guardian .authentication(forDomain: "{yourTenantDomain}", device: device) .reject(notification: notification) // or reject(notification: notification, withReason: "hacked") .start { result in switch result { case .success: // the auth request was successfully rejected case .failure(let cause): // something failed, check cause to see what went wrong } }
不正なコードを報告
コピー
AIに質問
guardian .reject(notification, enrollment) // or reject(notification, enrollment, reason) .execute(); // or start(new Callback<> ...)