Пример #1
0
        /// <summary>
        ///
        /// </summary>
        public ProcessEngineWrapper(ProcessInstanceConverter processInstanceConverter,
                                    PageableProcessInstanceRepositoryService pageableProcessInstanceService,
                                    TaskConverter taskConverter,
                                    PageableTaskRepositoryService pageableTaskService,
                                    MessageProducerActivitiEventListener listener,
                                    SecurityPoliciesApplicationService securityService,
                                    AuthenticationWrapper authenticationWrapper,
                                    IApplicationEventPublisher eventPublisher,
                                    IProcessEngine processEngine,
                                    HistoricInstanceConverter historicInstanceConverter,
                                    ILoggerFactory loggerFactory)
        {
            this.processEngine                  = processEngine;
            this.processInstanceConverter       = processInstanceConverter;
            this.runtimeService                 = processEngine.RuntimeService;
            this.pageableProcessInstanceService = pageableProcessInstanceService;
            this.taskService         = processEngine.TaskService;
            this.taskConverter       = taskConverter;
            this.pageableTaskService = pageableTaskService;
            this.historyService      = processEngine.HistoryService;
#warning 暂时不处理事件侦听
            //this.runtimeService.addEventListener(listener);
            this.securityService           = securityService;
            this.repositoryService         = processEngine.RepositoryService;
            this.authenticationWrapper     = authenticationWrapper;
            this.eventPublisher            = eventPublisher;
            this.historicInstanceConverter = historicInstanceConverter;
            logger = loggerFactory.CreateLogger <ProcessEngineWrapper>();
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public async Task Invoke(HttpContext context)
        {
            //IMvcControllerDiscovery mvcControllerDiscovery = context.RequestServices.GetService<IMvcControllerDiscovery>();

            //var controllers = mvcControllerDiscovery.GetControllers();

#if DEBUG
            if (context.Request.Path.HasValue &&
                new Regex("/swagger/?").IsMatch(context.Request.Path.Value))
            {
                await next(context).ConfigureAwait(false);

                return;
            }
#endif
            IAccessTokenProvider tokenProvider = context.RequestServices.GetRequiredService <IAccessTokenProvider>();

            SecurityPoliciesApplicationService spas = context.RequestServices.GetService <SecurityPoliciesApplicationService>();

            spas.User = await tokenProvider.GetUser(context).ConfigureAwait(false);

            Authentication.AuthenticatedUser = spas.User;

            await next(context).ConfigureAwait(false);
        }