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));
            }
Exemplo n.º 2
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);
                }
            }