Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDKS-2995_Device_Binding_Block_Simulator #260

Merged
merged 7 commits into from
Feb 27, 2024
4 changes: 2 additions & 2 deletions FRCore/FRCore/Authenticator/CryptoKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ public struct CryptoKey {
query[String(kSecReturnRef)] = true
query[String(kSecAttrApplicationTag)] = keyAlias

#if !targetEnvironment(simulator)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update copyright

if let pin = pin {
let context = LAContext()
let credentialIsSet = context.setCredential(pin.data(using: .utf8), type: .applicationPassword)
guard credentialIsSet == true else { return nil }
context.interactionNotAllowed = false
query[kSecUseAuthenticationContext as String] = context
}
#endif


if let accessGroup = accessGroup {
query[String(kSecAttrAccessGroup)] = accessGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ open class DeviceBindingCallback: MultipleValuesCallback, Binding {
/// - Parameter completion: Completion block for Device binding result callback
open func bind(deviceAuthenticator: ((DeviceBindingAuthenticationType) -> DeviceAuthenticator)? = nil,
completion: @escaping DeviceBindingResultCallback) {

let authInterface = deviceAuthenticator?(deviceBindingAuthenticationType) ?? deviceAuthenticatorIdentifier(deviceBindingAuthenticationType)

let dispatchQueue = DispatchQueue(label: "com.forgerock.serialQueue", qos: .userInitiated)
Expand All @@ -167,7 +166,11 @@ open class DeviceBindingCallback: MultipleValuesCallback, Binding {
deviceId: String? = nil,
deviceRepository: DeviceBindingRepository = LocalDeviceBindingRepository(),
_ completion: @escaping DeviceBindingResultCallback) {

#if targetEnvironment(simulator)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update copyright

// DeviceBinding/Signing is not supported on the iOS Simulator
handleException(status: .unsupported(errorMessage: "DeviceBinding/Signing is not supported on the iOS Simulator"), completion: completion)
return
#endif
let authInterface = authInterface ?? getDeviceAuthenticator(type: deviceBindingAuthenticationType)
authInterface.initialize(userId: userId, prompt: Prompt(title: title, subtitle: subtitle, description: promptDescription))
let deviceId = deviceId ?? FRDevice.currentDevice?.identifier.getIdentifier()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,11 @@ open class DeviceSigningVerifierCallback: MultipleValuesCallback, Binding {
authInterface: DeviceAuthenticator,
customClaims: [String: Any] = [:],
_ completion: @escaping DeviceSigningResultCallback) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update copyright

#if targetEnvironment(simulator)
// DeviceBinding/Signing is not supported on the iOS Simulator
handleException(status: .unsupported(errorMessage: "DeviceBinding/Signing is not supported on the iOS Simulator"), completion: completion)
return
#endif
authInterface.initialize(userId: userKey.userId, prompt: Prompt(title: title, subtitle: subtitle, description: promptDescription))
guard authInterface.isSupported() else {
handleException(status: .unsupported(errorMessage: nil), completion: completion)
Expand Down
Loading