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

No way to disable useAccessControl #79

Closed
buguibu opened this issue Feb 18, 2020 · 1 comment · Fixed by #81
Closed

No way to disable useAccessControl #79

buguibu opened this issue Feb 18, 2020 · 1 comment · Fixed by #81
Labels
bug This points to a verified bug in the code

Comments

@buguibu
Copy link

buguibu commented Feb 18, 2020

Description

I'm trying to request Biometric only once, for that I deal with biometric by my own and use the keychain without access control, but there is no way, I ended by prompting for FaceId several times and is very annoying.

I guess it is related to #78.

Reproduction

final class KeychainManager {
    static let shared = KeychainManager()
    // MARK: - private methods
    private lazy var defaultKeychain: A0SimpleKeychain = {
        let keychain = A0SimpleKeychain(service: App.shared.isProductionRunEnvironment ? "Auth0" : "Auth0-STAGE")
        keychain.useAccessControl = false
        return keychain
    }()
    private lazy var context: LAContext = {
        var context = LAContext()
        context.touchIDAuthenticationAllowableReuseDuration = 60
        return context
    }()

    // MARK: Public methods
    func getPasswordWithBiometricAuth(_ completion: @escaping (String?) -> Void) {
        var error: NSError?
        if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
            log.debug("canEvaluatePolicy")
            context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics,
                                   localizedReason: NSLocalizedString("KeychainManager.shared.passwordPromptMessage",
                                                                      comment: "")
            ) { (success, _) in
                log.debug("policy with \(success ? "success":"failure")")
                if success,
                    let email = Defaults[.rememberedEmail],
                    let password = self.defaultKeychain.string(forKey: "\(email).password") {
                    completion(password)
                } else {
                    completion(nil)
                }
            }
        } else {
            completion(nil)
        }
    }

Environment

In my Podifle:

    pod 'Auth0', '~> 1.21'
    pod 'SimpleKeychain', '~> 0.10'

My project supports iOS 11.4 in advance.

@Widcket Widcket added bug This points to a verified bug in the code and removed F1: inspection required labels Feb 27, 2020
@Widcket
Copy link
Contributor

Widcket commented Feb 27, 2020

@buguibu this should be fixed in 0.11.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants