コード例 #1
0
 public OrganizationManagementQuery(IAuthenticationInformation authenticationInformation,
                                    IOrganizationRepository organizationRepository,
                                    IMapper mapper) : base(authenticationInformation)
 {
     _organizationRepository = organizationRepository;
     _mapper = mapper;
 }
        public override bool Login(string abiquoApiBaseUri, IAuthenticationInformation authenticationInformation)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(abiquoApiBaseUri));
            Contract.Requires(null != authenticationInformation);
            Contract.Ensures(Contract.Result <bool>() == !string.IsNullOrWhiteSpace(this.AbiquoApiBaseUri));
            Contract.Ensures(Contract.Result <bool>() == (null != this.AuthenticationInformation));
            Contract.Ensures(Contract.Result <bool>() == (null != this.CurrentUserInformation));

            return(default(bool));
        }
コード例 #3
0
 public CustomerManagementCommand(IAuthenticationInformation authenticationInformation,
                                  IOrganizationRepository organizationRepository,
                                  ICustomerRepository customerRepository,
                                  IMapper mapper,
                                  IUnitOfWork unitOfWork) : base(authenticationInformation)
 {
     _organizationRepository = organizationRepository;
     _customerRepository     = customerRepository;
     _unitOfWork             = unitOfWork;
     _mapper = mapper;
 }
コード例 #4
0
 public OrganizationMembershipManagementQuery(IAuthenticationInformation authenticationInformation,
                                              ISuperAdminMembershipRepository superAdminMembershipRepository,
                                              IAdminMembershipRepository adminMembershipRepository,
                                              ICustomerMembershipRepository customerMembershipRepository,
                                              ICollectorMembershipRepository collectorMembershipRepository,
                                              ISecretaryMembershipRepository secretaryMembershipRepository,
                                              IDeliveryMembershipRepository deliveryMembershipRepository,
                                              IUserRepository userRepository,
                                              IMapper mapper) : base(authenticationInformation)
 {
     _superAdminMembershipRepository = superAdminMembershipRepository;
     _adminMembershipRepository      = adminMembershipRepository;
     _customerMembershipRepository   = customerMembershipRepository;
     _collectorMembershipRepository  = collectorMembershipRepository;
     _secretaryMembershipRepository  = secretaryMembershipRepository;
     _deliveryMembershipRepository   = deliveryMembershipRepository;
     _userRepository = userRepository;
     _mapper         = mapper;
 }
コード例 #5
0
        public AuthenticationCommand(IAuthenticationInformation authenticationInformation,
                                     IJsonWebTokenEngine jsonWebTokenEngine,
                                     ISuperAdminMembershipRepository superAdminMembershipRepository,
                                     IAdminMembershipRepository adminMembershipRepository,
                                     ICustomerMembershipRepository customerMembershipRepository,
                                     ICollectorMembershipRepository collectorMembershipRepository,
                                     ISecretaryMembershipRepository secretaryMembershipRepository,
                                     IDeliveryMembershipRepository deliveryMembershipRepository,
                                     IUserRepository userRepository) : base(authenticationInformation)
        {
            _superAdminMembershipRepository = superAdminMembershipRepository;
            _adminMembershipRepository      = adminMembershipRepository;
            _customerMembershipRepository   = customerMembershipRepository;
            _collectorMembershipRepository  = collectorMembershipRepository;
            _secretaryMembershipRepository  = secretaryMembershipRepository;
            _secretaryMembershipRepository  = secretaryMembershipRepository;
            _deliveryMembershipRepository   = deliveryMembershipRepository;

            _jsonWebTokenEngine = jsonWebTokenEngine;
            _userRepository     = userRepository;
        }
コード例 #6
0
ファイル: Startup.cs プロジェクト: hamidrezaaee/Diba
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(options => options.ModelValidatorProviders.Clear()).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo
                {
                    Title   = "My API",
                    Version = "v1"
                });

                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);

                c.IncludeXmlComments(xmlPath);
                c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
                {
                    In          = ParameterLocation.Header,
                    Description = "Please insert JWT with Bearer into field",
                    Name        = "Authorization",
                    Type        = SecuritySchemeType.ApiKey
                });
                c.AddSecurityRequirement(new OpenApiSecurityRequirement
                {
                    {
                        new OpenApiSecurityScheme
                        {
                            Reference = new OpenApiReference
                            {
                                Type = ReferenceType.SecurityScheme,
                                Id   = "Bearer"
                            }
                        },
                        new string[] { }
                    }
                });
            });

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddFromConfigurationFile(Configuration.GetSection("Services"));

            ServiceProvider            serviceProvider           = services.BuildServiceProvider();
            IAuthenticationCommand     authenticationCommand     = serviceProvider.GetService <IAuthenticationCommand>();
            IAuthenticationQuery       authenticationQuery       = serviceProvider.GetService <IAuthenticationQuery>();
            IAuthenticationInformation authenticationInformation = serviceProvider.GetService <IAuthenticationInformation>();

            services.AddControllers(config =>
            {
                config.Filters.Add(new AuthenticationFilter(authenticationInformation, authenticationCommand, authenticationQuery));
                config.Filters.Add(new ActionFilterExample());
            });

            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new UserManagementMappingProfile());
                mc.AddProfile(new CustomerManagementMappingProfile());
                mc.AddProfile(new OrganizationManagementMappingProfile());
                mc.AddProfile(new OrganizationMembershipManagementMappingProfile());
            });

            IMapper mapper = mappingConfig.CreateMapper();

            services.AddSingleton(mapper);
        }
コード例 #7
0
 public AuthenticationQuery(IAuthenticationInformation authenticationInformation,
                            IJsonWebTokenEngine jsonWebTokenEngine)
     : base(authenticationInformation)
 {
     _jsonWebTokenEngine = jsonWebTokenEngine;
 }
コード例 #8
0
ファイル: BaseService.cs プロジェクト: hamidrezaaee/Diba
 public BaseService(IAuthenticationInformation authenticationInformation)
 {
     AuthenticationInformation = authenticationInformation;
 }
コード例 #9
0
 public AuthenticationFilter(IAuthenticationInformation authenticationInformation, IAuthenticationCommand authenticationCommand, IAuthenticationQuery authenticationQuery)
 {
     _authenticationCommand     = authenticationCommand;
     _authenticationQuery       = authenticationQuery;
     _authenticationInformation = authenticationInformation;
 }