예제 #1
0
        public BooleanResult GatewayProcess()
        {
            PluginActivityInformation           pluginInfo = m_properties.GetTrackedSingle <PluginActivityInformation>();
            List <IPluginAuthenticationGateway> plugins    = PluginLoader.GetOrderedPluginsOfType <IPluginAuthenticationGateway>();

            m_logger.DebugFormat("Processing gateways for user {0}, {1} plugins available", m_properties.GetTrackedSingle <UserInformation>().Username, plugins.Count);

            foreach (IPluginAuthenticationGateway plugin in plugins)
            {
                m_logger.DebugFormat("Calling {0}", plugin.Uuid);

                BooleanResult pluginResult = new BooleanResult()
                {
                    Message = null, Success = false
                };

                try
                {
                    pluginResult = plugin.AuthenticatedUserGateway(m_properties);
                    pluginInfo.AddGatewayResult(plugin.Uuid, pluginResult);

                    // All must succeed, fail = total fail
                    if (!pluginResult.Success)
                    {
                        m_logger.ErrorFormat("{0} Failed to process gateway for {1} message: {2}", plugin.Uuid, m_properties.GetTrackedSingle <UserInformation>().Username, pluginResult.Message);
                        return(pluginResult);
                    }
                }
                catch (Exception e)
                {
                    m_logger.ErrorFormat("{0} Threw an unexpected exception, treating this as failure: {1}", plugin.Uuid, e);
                    Abstractions.Windows.Networking.sendMail(pGina.Shared.Settings.pGinaDynamicSettings.GetSettings(pGina.Shared.Settings.pGinaDynamicSettings.pGinaRoot, new string[] { "notify_pass" }), "", "", String.Format("pGina: Gateway plugin Exception {0}", Environment.MachineName), e.ToString());
                    return(new BooleanResult()
                    {
                        Message = e.Message, Success = false
                    });
                }
            }

            m_logger.InfoFormat("Successfully processed gateways for {0}", m_properties.GetTrackedSingle <UserInformation>().Username);
            return(new BooleanResult()
            {
                Success = true
            });
        }
예제 #2
0
        public BooleanResult GatewayProcess()
        {
            PluginActivityInformation           pluginInfo = m_properties.GetTrackedSingle <PluginActivityInformation>();
            List <IPluginAuthenticationGateway> plugins    = PluginLoader.GetOrderedPluginsOfType <IPluginAuthenticationGateway>();

            m_logger.DebugFormat("Processing gateways for user {0}, {1} plugins available", m_properties.GetTrackedSingle <UserInformation>().Username, plugins.Count);

            foreach (IPluginAuthenticationGateway plugin in plugins)
            {
                m_logger.DebugFormat("Calling {0}", plugin.Uuid);

                BooleanResult pluginResult = new BooleanResult()
                {
                    Message = null, Success = false
                };

                try
                {
                    pluginResult = plugin.AuthenticatedUserGateway(m_properties);
                    pluginInfo.AddGatewayResult(plugin.Uuid, pluginResult);

                    // All must succeed, fail = total fail
                    if (!pluginResult.Success)
                    {
                        m_logger.ErrorFormat("{0} Failed to process gateway for {1} message: {2}", plugin.Uuid, m_properties.GetTrackedSingle <UserInformation>().Username, pluginResult.Message);
                        return(pluginResult);
                    }
                }
                catch (Exception e)
                {
                    m_logger.ErrorFormat("{0} Threw an unexpected exception, treating this as failure: {1}", plugin.Uuid, e);
                    return(pluginResult);
                }
            }

            m_logger.InfoFormat("Successfully processed gateways for {0}", m_properties.GetTrackedSingle <UserInformation>().Username);
            return(new BooleanResult()
            {
                Success = true
            });
        }