Ejemplo n.º 1
0
        public static void ConfigureService(ServiceBuilder <ClientServiceControl> builder)
        {
            builder
            .ConfigureContainer(
                cfg =>
            {
                // bus
                cfg
                .RegisterRequestClient <IListUsersInGroup, IListUsersInGroupResult>(WellKnownQueues.Ldap)
                .RegisterRequestClient <IAuthenticateUser, IAuthenticateUserResult>(WellKnownQueues.AccessControl)
                .RegisterRequestClient <IListAccessRights, IListAccessRightsResult>(WellKnownQueues.AccessControl)
                .RegisterRequestClient <IListUsersBiometric, IListUsersBiometricResult>(WellKnownQueues.AccessControl);

                // this app
                cfg
                .RegisterType <IClientCredentials, ClientCredentials>()
                .RegisterType <IAccessPermissionCollection, AccessPermissionCollection>(new ContainerControlledLifetimeManager())
                .RegisterType <IAccessPermissionService, AccessPermissionService>();

                // vendor
                cfg.RegisterType <IAccessCheckService, AccessCheckService>();
            })
            .ConfigureBus(
                (cfg, host, container) =>
            {
                cfg.ReceiveEndpoint(
                    host,
                    "AccessControl.Client",
                    e =>
                {
                    e.Consumer(() => container.Resolve <EventConsumer>());
                });
            });
        }
Ejemplo n.º 2
0
 public static void  ConfigureService(ServiceBuilder <BusServiceControl> builder)
 {
     builder
     .ConfigureContainer(
         cfg =>
     {
         cfg.RegisterType <IEncryptor, Encryptor>();
         cfg.RegisterInstance((ILdapConfig)ConfigurationManager.GetSection("ldap"));
         cfg.RegisterType <ILdapService, LdapService>();
     })
     .ConfigureBus(
         (cfg, host, container) =>
     {
         cfg.UseTickets(container.Resolve <Encryptor>());
         cfg.ReceiveEndpoint(
             host,
             WellKnownQueues.Ldap,
             e =>
         {
             //e.AutoDelete = true;
             //e.Durable = false;
             e.Consumer(() => container.Resolve <UserConsumer>());
             e.Consumer(() => container.Resolve <UserGroupConsumer>());
             e.Consumer(() => container.Resolve <DepartmentConsumer>());
         });
     },
         bus =>
     {
         // Cross-services SSO
         bus.ConnectThreadPrincipal();
     });
 }
        public static void ConfigureService(ServiceBuilder <BusServiceControl> builder)
        {
            builder
            .ConfigureContainer(
                cfg =>
            {
                // types
                cfg
                .RegisterInstance((IDataConfiguration)ConfigurationManager.GetSection("dataConfig"), new ContainerControlledLifetimeManager())
                .RegisterType <ISessionFactoryHolder, SessionFactoryHolder>(new ContainerControlledLifetimeManager())
                .RegisterType <IAccessRightsManager, AccessRightsManager>()
                .RegisterType <IEncryptor, Encryptor>();

                // request clients
                cfg
                .RegisterRequestClient <IListUsersInGroup, IListUsersInGroupResult>(WellKnownQueues.Ldap)
                .RegisterRequestClient <ICheckCredentials, ICheckCredentialsResult>(WellKnownQueues.Ldap)
                .RegisterRequestClient <IFindUserByName, IFindUserByNameResult>(WellKnownQueues.Ldap)
                .RegisterRequestClient <IFindUserGroupByName, IFindUserGroupByNameResult>(WellKnownQueues.Ldap)
                .RegisterRequestClient <IListUsers, IListUsersResult>(WellKnownQueues.Ldap)
                .RegisterRequestClient <IListDepartments, IListDepartmentsResult>(WellKnownQueues.Ldap);
            })
            .ConfigureBus(
                (cfg, host, container) =>
            {
                cfg.UseTickets(container.Resolve <Encryptor>());
                cfg.ReceiveEndpoint(
                    host,
                    WellKnownQueues.AccessControl,
                    e =>
                {
                    e.ReceivePing();
                    e.Consumer <AuthenticationConsumer>(container);
                    e.Consumer <AccessPointConsumer>(container);
                    e.Consumer <BiometricInfoConsumer>(container);
                    e.Consumer <AccessRightsConsumer>(container);
                    e.Consumer <LoggingConsumer>(container);
                    e.Consumer <DelegateConsumer>(container);
                });
            },
                bus =>
            {
                // Cross-services SSO
                bus.ConnectThreadPrincipal();
            });
        }
Ejemplo n.º 4
0
        public static void ConfigureService(ServiceBuilder <NotificationServiceControl> builder)
        {
            builder
            .ConfigureContainer(
                cfg =>
            {
                cfg
                .RegisterInstance((INotificationConfig)ConfigurationManager.GetSection("notification"))
                .RegisterType <INotificationService, NotificationService>()
                .RegisterType <IScheduleFactory, ScheduleFactory>()
                .RegisterRequestClient <IFindUserByName, IFindUserByNameResult>(WellKnownQueues.Ldap)
                .RegisterRequestClient <IFindUserByBiometrics, IFindUserByBiometricsResult>(WellKnownQueues.AccessControl)
                .RegisterRequestClient <IFindAccessPointById, IFindAccessPointByIdResult>(WellKnownQueues.AccessControl);

                //var scheduler = new StdSchedulerFactory().GetScheduler();
                //cfg.RegisterInstance(scheduler);
                cfg.RegisterType <IScheduler>(
                    new ContainerControlledLifetimeManager(),
                    new InjectionFactory(c => new StdSchedulerFactory().GetScheduler()));
            })
            .ConfigureBus(
                (cfg, host, container) =>
            {
                var rabbitMqConfig = container.Resolve <IServiceConfig>().RabbitMq;
                cfg.UseMessageScheduler(new Uri(rabbitMqConfig.GetQueueUrl(WellKnownQueues.Notifications)));
                cfg.UseTickets(container.Resolve <Encryptor>());
                cfg.ReceiveEndpoint(
                    host,
                    WellKnownQueues.Notifications,
                    e =>
                {
                    e.Consumer(() => container.Resolve <NotificationConsumer>());
                    e.Consumer(() => container.Resolve <RedeliveryConsumer>());
                    e.Consumer(() => container.Resolve <ScheduleMessageConsumer>());
                    e.Consumer(() => container.Resolve <CancelScheduledMessageConsumer>());
                    e.Consumer(() => container.Resolve <DailyReportConsumer>());
                });
            },
                bus =>
            {
                // Cross-services SSO
                bus.ConnectThreadPrincipal();
            });
        }