public Task AuthenticateAsync(
                string[] authenticationTypes,
                AuthenticateCallback callback,
                object state)
            {
                if (authenticationTypes == null)
                {
                    callback(null, null, _handler.BaseOptions.Description.Properties, state);
                }
                else if (authenticationTypes.Contains(_handler.BaseOptions.AuthenticationType, StringComparer.Ordinal))
                {
                    var authTsk = _handler.AuthenticateAsync();
                    authTsk.Wait();
                    AuthenticationTicket ticket = authTsk.Result;
                    if (ticket != null && ticket.Identity != null)
                    {
                        callback(ticket.Identity, ticket.Properties.Dictionary, _handler.BaseOptions.Description.Properties, state);
                    }
                }
                if (Chained != null)
                {
                    Chained(authenticationTypes, callback, state).Wait();
                }


                return(TaskHelpers.FromResult <object>(null));
            }
Пример #2
0
        /// <summary>
        /// AuthenticatedSubPageManager constructor
        /// </summary>
        /// <param name="authenticateCallback">Callback function to authenticateCallback</param>
        /// <param name="panel">The panel Auth manager has to link</param>
        /// <param name="lockPage">Instance of the PinLockSubPage class to collect auth info</param>
        /// <param name="inactivityTime">Amount of time of inactivity to automaticaly lock the panel, in milliseconds</param>
        /// <param name="subPages">List of other subpages this SubPage manager shall manage</param>
        public AuthenticatedSubPageManager(AuthenticateCallback authenticateCallback, BasicTriListWithSmartObject panel, PinLockSubPage lockPage, long inactivityTime, List <SubPage> subPages)
            : base(panel, subPages)
        {
            _authenticateCallback  = authenticateCallback;
            _lockPage              = lockPage;
            _lockPage.Panel        = panel;
            _lockPage.Authenticate = new Func <ushort, bool>(pageAuthenticateCallback);

            _inactivityTime  = inactivityTime;
            _inactivityTimer = new CTimer(inactivityTimerCallback, Timeout.Infinite);

            AuthenticatedLevel = AuthenticatedLevel.None;

            panel.SigChange += new SigEventHandler(activityDetectionHandler);
            foreach (var kv in panel.SmartObjects)
            {
                kv.Value.SigChange += new SmartObjectSigChangeEventHandler(activityDetectionHandler);
            }
        }
Пример #3
0
 public async Task AuthenticateAsync(
     string[] authenticationTypes,
     AuthenticateCallback callback,
     object state)
 {
     if (authenticationTypes == null)
     {
         callback(null, null, _handler.BaseOptions.Description.Properties, state);
     }
     else if (authenticationTypes.Contains(_handler.BaseOptions.AuthenticationType, StringComparer.Ordinal))
     {
         AuthenticationTicket ticket = await _handler.AuthenticateAsync();
         if (ticket != null && ticket.Identity != null)
         {
             callback(ticket.Identity, ticket.Properties.Dictionary, _handler.BaseOptions.Description.Properties, state);
         }
     }
     if (Chained != null)
     {
         await Chained(authenticationTypes, callback, state);
     }
 }
Пример #4
0
            public async Task Authenticate(
                string[] authenticationTypes,
                AuthenticateCallback callback,
                object state)
            {
                if (authenticationTypes == null)
                {
                    callback(null, null, _handler.BaseOptions.Description.Properties, state);
                }
                else if (authenticationTypes.Contains(_handler.BaseOptions.AuthenticationType, StringComparer.Ordinal))
                {
                    AuthenticationTicket ticket = await _handler.Authenticate();

                    if (ticket != null && ticket.Identity != null)
                    {
                        callback(ticket.Identity, ticket.Extra.Properties, _handler.BaseOptions.Description.Properties, state);
                    }
                }
                if (Chained != null)
                {
                    await Chained(authenticationTypes, callback, state);
                }
            }
Пример #5
0
 /// <summary>
 /// AuthenticatedSubPageManager constructor
 /// </summary>
 /// <param name="authenticateCallback">Callback function to authenticateCallback</param>
 /// <param name="panel">The panel Auth manager has to link</param>
 /// <param name="lockPage">Instance of the PinLockSubPage class to collect auth info</param>
 /// <param name="inactivityTime">Amount of time of inactivity to automaticaly lock the panel, in milliseconds</param>
 public AuthenticatedSubPageManager(AuthenticateCallback authenticateCallback, BasicTriListWithSmartObject panel, PinLockSubPage lockPage, long inactivityTime)
     : this(authenticateCallback, panel, lockPage, inactivityTime, new List <SubPage>())
 {
 }