private void SetupContextProperties(AuthenticationRequestConfiguration authRequestConfig)
        {
            if (_context.RespondsToSelector(new Selector("localizedFallbackTitle")))
            {
                _context.LocalizedFallbackTitle = authRequestConfig.FallbackTitle;
            }

            if (_context.RespondsToSelector(new Selector("localizedCancelTitle")))
            {
                _context.LocalizedCancelTitle = authRequestConfig.CancelTitle;
            }
        }
Example #2
0
        private void SetupContextProperties(AuthenticationRequestConfiguration authRequestConfig)
        {
            if (_context.RespondsToSelector(new Selector("localizedFallbackTitle")))
            {
                _context.LocalizedFallbackTitle = authRequestConfig.FallbackTitle;
            }
#if !__MAC__ // will be included in Cycle 9
            if (_context.RespondsToSelector(new Selector("localizedCancelTitle")))
            {
                _context.LocalizedCancelTitle = authRequestConfig.CancelTitle;
            }
#endif
        }
 private void CancelAuthentication()
 {
     if (_context.RespondsToSelector(new Selector("invalidate")))
     {
         _context.Invalidate();
         _context = new LAContext();
     }
 }
        public override async Task <AuthenticationType> GetAuthenticationTypeAsync()
        {
            if (_context == null)
            {
                return(AuthenticationType.None);
            }

            // we need to call this, because it will always return none, if you don't call CanEvaluatePolicy
            var availibility = await GetAvailabilityAsync(false);

            // iOS 11+
            if (_context.RespondsToSelector(new Selector("biometryType")))
            {
                switch (_context.BiometryType)
                {
                case LABiometryType.None:
                    return(AuthenticationType.None);

                case LABiometryType.TouchId:
                    return(AuthenticationType.Fingerprint);

                case LABiometryType.FaceId:
                    return(AuthenticationType.Face);

                default:
                    return(AuthenticationType.None);
                }
            }

            // iOS < 11
            if (availibility == FingerprintAvailability.NoApi ||
                availibility == FingerprintAvailability.NoSensor ||
                availibility == FingerprintAvailability.Unknown)
            {
                return(AuthenticationType.None);
            }

            return(AuthenticationType.Fingerprint);
        }
        private void CreateNewContext()
        {
            if (_context != null)
            {
                if (_context.RespondsToSelector(new Selector("invalidate")))
                {
                    _context.Invalidate();
                }
                _context.Dispose();
            }

            CreateLaContext();
        }