コード例 #1
0
 public AuthenticationService(ITenantRepository tenantRepository, IUserRepository userRepository,
     IEncryptionService encryptionService)
 {
     this._tenantRepository = tenantRepository;
     this._userRepository = userRepository;
     this._encryptionService = encryptionService;
 }
コード例 #2
0
ファイル: UserManager.cs プロジェクト: nogalskisam/Fyl
 public UserManager(IUserRepository userRepository, ILandlordRepository landlordRepository, ITenantRepository tenantRepository, IPasswordHasher passwordHasher)
 {
     _userRepository = userRepository;
     _passwordHasher = passwordHasher;
     _landlordRepository = landlordRepository;
     _tenantRepository = tenantRepository;
 }
コード例 #3
0
 public TenantProvisioningService(ITenantRepository tenantRepository, IUserRepository userRepository,
     IRoleRepository roleRepository)
 {
     this._tenantRepository = tenantRepository;
     this._userRepository = userRepository;
     this._roleRepository = roleRepository;
 }
コード例 #4
0
 public AccessApplicationService(ITenantRepository tenantRepository, IGroupRepository groupRepository,
     IUserRepository userRepository, IRoleRepository roleRepository)
 {
     this._groupRepository = groupRepository;
     this._roleRepository = roleRepository;
     this._tenantRepository = tenantRepository;
     this._userRepository = userRepository;
 }
コード例 #5
0
 public TenantController(ILandlordRepository ll, IApartmentRepository a, 
                         ILocationRepository lo, ITenantRepository t, IContext con)
 {
     TRepo = t;
     AptRepo = a;
     LocRepo = lo;
     LLRepo = ll;
     context = con;
 }
コード例 #6
0
 public LocationController(ILandlordRepository ll, IApartmentRepository a,
     ILocationRepository lo, ITenantRepository t, IContext con, IImageRepository img)
 {
     TRepo = t;
     AptRepo = a;
     LocRepo = lo;
     LLRepo = ll;
     context = con;
     imageRepo = img;
 }
コード例 #7
0
 public IdentityApplicationService(AuthenticationService authenticationService,
     GroupMemberService groupMemberService, TenantProvisioningService tenantProvisioningService,
     ITenantRepository tenantRepository, IGroupRepository groupRepository, IUserRepository userRepository)
 {
     this._authenticationService = authenticationService;
     this._groupMemberService = groupMemberService;
     this._groupRepository = groupRepository;
     this._tenantProvisioningService = tenantProvisioningService;
     this._tenantRepository = tenantRepository;
     this._userRepository = userRepository;
 }
コード例 #8
0
ファイル: ProducerHub.cs プロジェクト: buildersoftdev/andyx
 public ProducerHub(ILogger <ProducerHub> logger,
                    IProducerHubRepository producerHubRepository,
                    ITenantRepository tenantRepository,
                    ITenantFactory tenantFactory,
                    IProducerFactory producerFactory,
                    IStorageHubService storageHubService,
                    IConsumerHubService consumerHubService)
 {
     this.logger = logger;
     this.producerHubRepository = producerHubRepository;
     this.tenantRepository      = tenantRepository;
     this.tenantFactory         = tenantFactory;
     this.producerFactory       = producerFactory;
     this.storageHubService     = storageHubService;
     this.consumerHubService    = consumerHubService;
 }
コード例 #9
0
 public ConsumerHubService(ILogger <ConsumerHubService> logger,
                           IHubContext <ConsumerHub, IConsumerHub> hub,
                           IConsumerHubRepository consumerHubRepository,
                           IStorageHubService storageHubService,
                           ITenantRepository tenantRepository,
                           ITenantService tenantApiService,
                           IComponentService componentApiService)
 {
     _logger = logger;
     _hub    = hub;
     _consumerHubRepository = consumerHubRepository;
     _storageHubService     = storageHubService;
     _tenantRepository      = tenantRepository;
     _tenantApiService      = tenantApiService;
     _componentApiService   = componentApiService;
 }
コード例 #10
0
ファイル: LoginLogic.cs プロジェクト: sinpcw/kamonohashi
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public LoginLogic(
     ITenantRepository tenantRepository,
     IUserRepository userRepository,
     ISettingRepository settingRepository,
     IUnitOfWork unitOfWork,
     ICommonDiLogic commonDiLogic,
     IOptions <ActiveDirectoryOptions> adOptions,
     IOptions <WebSecurityOptions> webSecurityOptions) : base(commonDiLogic)
 {
     this.tenantRepository   = tenantRepository;
     this.userRepository     = userRepository;
     this.settingRepository  = settingRepository;
     this.unitOfWork         = unitOfWork;
     this.adOptions          = adOptions.Value;
     this.webSecurityOptions = webSecurityOptions.Value;
 }
コード例 #11
0
 public UserController(
     UserManager <ApplicationUser> userManager,
     IOptions <JwtIssuerOptions> jwtOptions,
     IJwtFactory jwtFactory,
     IRequestContext requestContext,
     ITenantRepository tenantRepository,
     IUserService userService,
     IConfiguration configuration) : base(requestContext)
 {
     _userManager      = userManager;
     _jwtFactory       = jwtFactory;
     _jwtOptions       = jwtOptions.Value;
     _tenantRepository = tenantRepository;
     _userService      = userService;
     _configuration    = configuration;
 }
コード例 #12
0
        protected void SetUp()
        {
            ContainerBuilder builder = new ContainerBuilder();
            builder.RegisterType<MD5EncryptionService>().As<IEncryptionService>();
            IContainer container = builder.Build();
            ServiceLocator.Resolver = new AutofacResolver(container);

            _sessionProvider = new SessionProvider("server=.;uid=sa;pwd=truth;Trusted_Connection=no;database=IDDD", typeof(GroupRepository).Assembly);
            this.UserRepository = new UserRepository(_sessionProvider);
            this.GroupRepository = new GroupRepository(_sessionProvider);
            this.TenantRepository = new TenantRepository(_sessionProvider);
            this.RoleRepository = new RoleRepository(_sessionProvider);
            _transaction = Session.BeginTransaction();

            DomainEventPublisher.Instance.Reset();
        }
コード例 #13
0
        public TenantResolver(HostContext context, IHttpContextAccessor accessor, IAliasRepository aliasrepository, ITenantRepository tenantrepository)
        {
            db = context;
            _aliasrepository  = aliasrepository;
            _tenantrepository = tenantrepository;

            // get alias based on request context
            aliasname = accessor.HttpContext.Request.Host.Value;
            string path = accessor.HttpContext.Request.Path.Value;

            string[] segments = path.Split('/');
            if (segments[1] != "~")
            {
                aliasname += "/" + segments[1];
            }
        }
コード例 #14
0
 public PatchTenantCommand(
     IActionContextAccessor actionContextAccessor,
     IObjectModelValidator objectModelValidator,
     ITenantRepository tenantRepository,
     IMapper <Data.Tenant, ViewModels.Tenant> tenantToTenantMapper,
     IMapper <Data.Tenant, SaveTenant> tenantToSaveTenantMapper,
     IMapper <SaveTenant, Data.Tenant> saveTenantToTenantMapper,
     IHostTenantInfo host)
 {
     this.actionContextAccessor    = actionContextAccessor ?? throw new ArgumentNullException(nameof(actionContextAccessor));
     this.objectModelValidator     = objectModelValidator ?? throw new ArgumentNullException(nameof(objectModelValidator));
     this.tenantRepository         = tenantRepository ?? throw new ArgumentNullException(nameof(tenantRepository));
     this.tenantToTenantMapper     = tenantToTenantMapper ?? throw new ArgumentNullException(nameof(tenantToTenantMapper));
     this.tenantToSaveTenantMapper = tenantToSaveTenantMapper ?? throw new ArgumentNullException(nameof(tenantToSaveTenantMapper));
     this.saveTenantToTenantMapper = saveTenantToTenantMapper ?? throw new ArgumentNullException(nameof(saveTenantToTenantMapper));
     this.host = host ?? throw new ArgumentNullException(nameof(host));
 }
コード例 #15
0
ファイル: LoginController.cs プロジェクト: ITfoxtec/FoxIDs
 public LoginController(TelemetryScopedLogger logger, IStringLocalizer localizer, ITenantRepository tenantRepository, LoginPageLogic loginPageLogic, SessionLoginUpPartyLogic sessionLogic, SequenceLogic sequenceLogic, SecurityHeaderLogic securityHeaderLogic, AccountLogic userAccountLogic, AccountActionLogic accountActionLogic, ClaimTransformLogic claimTransformLogic, LoginUpLogic loginUpLogic, LogoutUpLogic logoutUpLogic, SingleLogoutDownLogic singleLogoutDownLogic, OAuthRefreshTokenGrantDownLogic <OAuthDownClient, OAuthDownScope, OAuthDownClaim> oauthRefreshTokenGrantLogic) : base(logger)
 {
     this.logger                      = logger;
     this.localizer                   = localizer;
     this.tenantRepository            = tenantRepository;
     this.loginPageLogic              = loginPageLogic;
     this.sessionLogic                = sessionLogic;
     this.sequenceLogic               = sequenceLogic;
     this.securityHeaderLogic         = securityHeaderLogic;
     this.userAccountLogic            = userAccountLogic;
     this.accountActionLogic          = accountActionLogic;
     this.claimTransformLogic         = claimTransformLogic;
     this.loginUpLogic                = loginUpLogic;
     this.logoutUpLogic               = logoutUpLogic;
     this.singleLogoutDownLogic       = singleLogoutDownLogic;
     this.oauthRefreshTokenGrantLogic = oauthRefreshTokenGrantLogic;
 }
コード例 #16
0
ファイル: Startup.cs プロジェクト: candyalladi/BookMyHotel
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });


            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
            .AddDataAnnotationsLocalization();

            services.AddMvcCore()
            .AddDataAnnotations();

            // Adds a default in-memory implementation of IDistributedCache.
            services.AddDistributedMemoryCache();
            services.AddSession();

            //register catalog DB
            services.AddDbContext <CatalogDbContext>(options => options.UseSqlServer(GetCatalogConnectionString(CatalogConfig, DatabaseConfig)));

            //Add Application services
            services.AddTransient <ICatalogRepository, CatalogRepository>();
            services.AddTransient <ITenantRepository, TenantRepository>();
            services.AddSingleton <ITenantRepository>(p => new TenantRepository(GetBasicSqlConnectionString()));
            services.AddSingleton <IConfiguration>(Configuration);
            services.AddSingleton <ILookupClient>(p => new LookupClient());
            services.AddSingleton <IEmailService>(p => new EmailService());
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(options =>
            {
                options.LoginPath  = "/Account/Login";
                options.LogoutPath = "Account/Logout";
            });

            //create instance of utilities class
            services.AddTransient <IUtilities, Utilities>();
            var provider = services.BuildServiceProvider();

            _utilities         = provider.GetService <IUtilities>();
            _catalogRepository = provider.GetService <ICatalogRepository>();
            _tenantRepository  = provider.GetService <ITenantRepository>();
            _client            = provider.GetService <ILookupClient>();
        }
コード例 #17
0
 public TenantManager(ILogger <TenantManager> logger,
                      ITenantRepository tenantRepository,
                      ICompanyManager companyManager,
                      ICompanyTenantRepository companyTenantRepository,
                      ICompanyRepository companyRepository)
 {
     _logger = logger ??
               throw new ArgumentNullException(nameof(logger));
     _tenantRepository = tenantRepository ??
                         throw new ArgumentNullException(nameof(_tenantRepository));
     _companyManager = companyManager ??
                       throw new ArgumentNullException(nameof(_companyManager));
     _companyTenantRepository = companyTenantRepository ??
                                throw new ArgumentNullException(nameof(_companyTenantRepository));
     _companyRepository = companyRepository ??
                          throw new ArgumentNullException(nameof(companyRepository));
 }
コード例 #18
0
 public CreateRuleService(
     ICreateRuleValidator createRuleValidator,
     IConditionNodeAbstractFactory conditionNodeAbstractFactory,
     IConditionTypeRepository conditionTypeRepository,
     IContentTypeRepository contentTypeRepository,
     IRuleFactory ruleFactory,
     IRuleRepository ruleRepository,
     ITenantRepository tenantRepository)
 {
     this.createRuleValidator          = createRuleValidator;
     this.conditionNodeAbstractFactory = conditionNodeAbstractFactory;
     this.conditionTypeRepository      = conditionTypeRepository;
     this.contentTypeRepository        = contentTypeRepository;
     this.ruleFactory      = ruleFactory;
     this.ruleRepository   = ruleRepository;
     this.tenantRepository = tenantRepository;
 }
コード例 #19
0
        private async Task <UpParty> GetUpPartyAsync(ITenantRepository tenantRepository, Track.IdKey trackIdKey, Group upPartyGroup)
        {
            var upPartyIdKey = new Party.IdKey
            {
                TenantName = trackIdKey.TenantName,
                TrackName  = trackIdKey.TrackName,
                PartyName  = upPartyGroup.Value,
            };

            try
            {
                return(await tenantRepository.GetUpPartyByNameAsync(upPartyIdKey));
            }
            catch (Exception ex)
            {
                throw new RouteCreationException($"Invalid tenantName '{upPartyIdKey.TenantName}', trackName '{upPartyIdKey.TrackName}' and upPartyName '{upPartyIdKey.PartyName}'.", ex);
            }
        }
コード例 #20
0
        private async Task <DownParty> GetDownPartyAsync(ITenantRepository tenantRepository, Track.IdKey trackIdKey, Group downPartyGroup, bool acceptUnknownParty)
        {
            var downPartyIdKey = new Party.IdKey
            {
                TenantName = trackIdKey.TenantName,
                TrackName  = trackIdKey.TrackName,
                PartyName  = downPartyGroup.Value,
            };

            try
            {
                return(await tenantRepository.GetDownPartyByNameAsync(downPartyIdKey, required : !acceptUnknownParty));
            }
            catch (Exception ex)
            {
                throw new RouteCreationException($"Invalid tenantName '{downPartyIdKey.TenantName}', trackName '{downPartyIdKey.TrackName}' and downPartyName '{downPartyIdKey.PartyName}'.", ex);
            }
        }
コード例 #21
0
 public StorageHub(ILogger <StorageHub> logger,
                   CredentialsConfiguration credentialsConfiguration,
                   IStorageHubRepository storageHubRepository,
                   ITenantRepository tenantMemoryRepository,
                   IStorageFactory storageFactory,
                   IAgentFactory agentFactory,
                   IConsumerHubService consumerHubService,
                   IProducerHubService producerHubService)
 {
     this.logger = logger;
     this.credentialsConfiguration = credentialsConfiguration;
     this.storageHubRepository     = storageHubRepository;
     this.tenantMemoryRepository   = tenantMemoryRepository;
     this.storageFactory           = storageFactory;
     this.agentFactory             = agentFactory;
     this.consumerHubService       = consumerHubService;
     this.producerHubService       = producerHubService;
 }
コード例 #22
0
 public IdentityApplicationService(
     IUnitOfWork unitOfWork,
     AuthenticationService authenticationService,
     GroupMemberService groupMemberService,
     IGroupRepository groupRepository,
     TenantProvisioningService tenantProvisioningService,
     ITenantRepository tenantRepository,
     IUserRepository userRepository
     )
 {
     this.unitOfWork                = unitOfWork;
     this.authenticationService     = authenticationService;
     this.groupMemberService        = groupMemberService;
     this.groupRepository           = groupRepository;
     this.tenantProvisioningService = tenantProvisioningService;
     this.tenantRepository          = tenantRepository;
     this.userRepository            = userRepository;
 }
コード例 #23
0
        public async Task <IActionResult> Register(CancellationToken cancellationToken,
                                                   [System.Web.Http.FromBody] CreateTenantBinding binding,
                                                   [FromServices] TenantManager manager,
                                                   [FromServices] ITenantRepository repository)
        {
            var tenant = await repository.Get(binding.Name, binding.Surname, binding.Password, cancellationToken);

            if (tenant != null)
            {
                return(BadRequest(new { errorText = "Invalid username or password." }));
            }

            try
            {
                tenant = await manager.Create(binding.Name,
                                              binding.Surname,
                                              binding.Password,
                                              binding.DateOfBirth,
                                              binding.Address,
                                              binding.EntranceNumber,
                                              binding.FlatNumber,
                                              cancellationToken);
            }
            catch (BuildingWithSuchAddressNotRegisteredException e)
            {
                return(NotFound());
            }

            if (binding.Avatar != null)
            {
                byte[] avatarData = null;

                using (var binaryReader = new BinaryReader(binding.Avatar.OpenReadStream()))
                {
                    avatarData = binaryReader.ReadBytes((int)binding.Avatar.Length);
                }

                tenant.PutAvatar(avatarData);
            }

            await repository.Save(tenant);

            return(await GetToken(tenant.TenatId));
        }
コード例 #24
0
        public async Task Invoke(HttpContext context, ITenantIdentificationService tenantIdentificationService,
                                 ITenantContextAccessor tenantContextAccessor, ITenantRepository tenantRepository, IOptions <TenancyHostingOptions> tenancyOptions)
        {
            if (tenancyOptions.Value.TenancyType == TenancyType.None)
            {
                await _next(context);

                return;
            }

            if (tenantContextAccessor.TenantContext != null)
            {
                throw new ApplicationException("Tenant context is already set");
            }

            var tenantId = await tenantIdentificationService.GetTenantIdAsync();

            var tenant = await tenantRepository.Get(tenantId, context.RequestAborted)
                         ?? throw new ApplicationException($"Tenant {tenantId} not found");

            if (tenant.IsShared && tenancyOptions.Value.TenancyType == TenancyType.MonoTenant)
            {
                throw new ApplicationException(
                          $"Received a message for shared tenant {tenantId} in a MonoTenant hosting");
            }

            if (!tenant.IsShared && tenancyOptions.Value.TenancyType == TenancyType.MultiTenant)
            {
                throw new ApplicationException(
                          $"Received a message for premium tenant {tenantId} in a MultiTenant (shared) context");
            }

            if (tenancyOptions.Value.TenancyType == TenancyType.MonoTenant && tenancyOptions.Value.TenantId != tenantId)
            {
                throw new ApplicationException(
                          $"Invalid tenant ID. Expected {tenancyOptions.Value.TenantId} but received {tenantId}");
            }


            tenantContextAccessor.TenantContext = new TenantContext(tenant);

            await _next(context);
        }
コード例 #25
0
        public TenantResolver(MasterDBContext context, IHttpContextAccessor accessor, IAliasRepository aliasrepository, ITenantRepository tenantrepository)
        {
            db = context;
            _aliasrepository  = aliasrepository;
            _tenantrepository = tenantrepository;

            // get alias based on request context
            aliasname = accessor.HttpContext.Request.Host.Value;
            string path = accessor.HttpContext.Request.Path.Value;

            string[] segments = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            if (segments.Length > 0 && segments[0] == "api" && segments[1] != "~")
            {
                aliasname += "/" + segments[1];
            }
            if (aliasname.EndsWith("/"))
            {
                aliasname = aliasname.Substring(0, aliasname.Length - 1);
            }
        }
コード例 #26
0
ファイル: RoleController.cs プロジェクト: ozota1/kamonohashi
        public async Task<IActionResult> GetDetailForAdmin(long? id, [FromServices] ITenantRepository tenantRepository)
        {
            if (id == null)
            {
                return JsonBadRequest("Role ID is required.");
            }
            var role = await roleRepository.GetRoleAsync(id.Value);
            if (role == null)
            {
                return JsonNotFound($"Node Id {id.Value} is not found.");
            }

            var model = new DetailsOutputModel(role);
            if (model.TenantId != null)
            {
                model.TenantName = tenantRepository.Get(model.TenantId.Value).Name;
            }

            return JsonOK(model);
        }
コード例 #27
0
        public async Task <IActionResult> DeleteForAdmin(long?id, [FromServices] ITenantRepository tenantRepository)
        {
            //データの入力チェック
            if (id == null)
            {
                return(JsonBadRequest("Invalid inputs."));
            }
            //データの存在チェック
            var role = await roleRepository.GetRoleAsync(id.Value);

            if (role == null)
            {
                return(JsonNotFound($"Role ID {id.Value} is not found."));
            }

            await roleRepository.DeleteAsync(id.Value, unitOfWork);

            unitOfWork.Commit();

            return(JsonNoContent());
        }
コード例 #28
0
            public static async Task <Tenant> CreateNewEntry(
                ITenantRepository repository,
                string name,
                string displayName,
                string description
                )
            {
                if (string.IsNullOrWhiteSpace(name))
                {
                    throw new ArgumentException("The tenant must be specified", nameof(name));
                }

                if (!Regex.IsMatch(name, "^(?=.{3,63}$)[a-z0-9]+(-[a-z0-9]+)*$"))
                {
                    throw new ArgumentException("The tenant name must have 3 to 63 characters, start with an alphanumeric character and contain alphanumeric characters or hyphens only");
                }

                if (!await repository.HasUniqName(name))
                {
                    throw new ArgumentException("An other tenant has the same name.", nameof(name));
                }

                if (!await repository.HasUniqArchivedName(name))
                {
                    throw new ArgumentException("An archived tenant has the same name.", nameof(name));
                }

                var tenant = new Tenant
                {
                    Id          = Guid.NewGuid(),
                    Name        = name,
                    DisplayName = displayName,
                    Description = description,
                    Enabled     = true,
                    RegionId    = TenantRegion.EUROPE.Id,
                    UsersNumber = 0
                };

                return(tenant);
            }
コード例 #29
0
        public TenantManager(ITenantRepository tenantRepository,
                             ICompanyRepository companyRepository,
                             IBranchRepository branchRepository,
                             ISupplierRepository supplierRepository,
                             IWarehouseRepository warehouseRepository,
                             ISubscriptionRepository subscriptionRepository,
                             IEditionRepository editionRepository,
                             ICompanySettingsRepository companySettingsRepository,
                             ISubscriptionPaymentRepository subscriptionPaymentRepository,
                             ISmsService smsService,
                             ICustomerRepository customerRepository,

                             IUserService userService,
                             RoleManager roleManager,
                             IEmployeeRepository employeeRepository,
                             ISecurityRepository <Role, string> roleRepository)
        {
            _tenantRepository              = tenantRepository;
            _companyRepository             = companyRepository;
            _branchRepository              = branchRepository;
            _supplierRepository            = supplierRepository;
            _warehouseRepository           = warehouseRepository;
            _subscriptionRepository        = subscriptionRepository;
            _editionRepository             = editionRepository;
            _companySettingsRepository     = companySettingsRepository;
            _subscriptionPaymentRepository = subscriptionPaymentRepository;
            _smsService = smsService;

            _userService        = userService;
            _roleManager        = roleManager;
            _userManager        = HttpContext.Current?.GetOwinContext()?.GetUserManager <UserManager>();
            _employeeRepository = employeeRepository;
            _roleRepository     = roleRepository;
            _customerRepository = customerRepository;

            var tenantId = HttpContext.Current?.Request.Headers["TenantId"];

            _userManager?.SetTenantId(string.IsNullOrWhiteSpace(tenantId) ? null : tenantId);
        }
コード例 #30
0
        public TenantResolver(MasterDBContext context, IHttpContextAccessor accessor, IAliasRepository Aliases, ITenantRepository Tenants, SiteState sitestate)
        {
            db             = context;
            this.Aliases   = Aliases;
            this.Tenants   = Tenants;
            this.sitestate = sitestate;
            aliasname      = "";

            // get alias based on request context
            if (accessor.HttpContext != null)
            {
                // check if an alias is passed as a querystring parameter
                if (accessor.HttpContext.Request.Query.ContainsKey("alias"))
                {
                    aliasname = accessor.HttpContext.Request.Query["alias"];
                }
                else // get the alias from the request url
                {
                    aliasname = accessor.HttpContext.Request.Host.Value;
                    string   path     = accessor.HttpContext.Request.Path.Value;
                    string[] segments = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    if (segments.Length > 1 && segments[1] == "api" && segments[0] != "~")
                    {
                        aliasname += "/" + segments[0];
                    }
                    if (aliasname.EndsWith("/"))
                    {
                        aliasname = aliasname.Substring(0, aliasname.Length - 1);
                    }
                }
            }
            else  // background processes can pass in an alias using the SiteState service
            {
                if (sitestate != null)
                {
                    aliasname = sitestate.Alias.Name;
                }
            }
        }
コード例 #31
0
 public TenantController(
     ITenantRepository tenantRepository,
     IUserRepository userRepository,
     IRoleRepository roleRepository,
     IRegistryRepository registryRepository,
     IGitRepository gitRepository,
     ICommonDiLogic commonDiLogic,
     IStorageLogic storageLogic,
     IClusterManagementLogic clusterManagementLogic,
     IUnitOfWork unitOfWork,
     IHttpContextAccessor accessor) : base(accessor)
 {
     this.tenantRepository       = tenantRepository;
     this.userRepository         = userRepository;
     this.roleRepository         = roleRepository;
     this.registryRepository     = registryRepository;
     this.gitRepository          = gitRepository;
     this.commonDiLogic          = commonDiLogic;
     this.storageLogic           = storageLogic;
     this.clusterManagementLogic = clusterManagementLogic;
     this.unitOfWork             = unitOfWork;
 }
コード例 #32
0
        public TenantResolver(MasterDBContext context, IHttpContextAccessor accessor, IAliasRepository Aliases, ITenantRepository Tenants)
        {
            db           = context;
            this.Aliases = Aliases;
            this.Tenants = Tenants;
            aliasname    = "";

            // get alias based on request context
            if (accessor.HttpContext != null)
            {
                aliasname = accessor.HttpContext.Request.Host.Value;
                string   path     = accessor.HttpContext.Request.Path.Value;
                string[] segments = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                if (segments.Length > 1 && segments[1] == "api" && segments[0] != "~")
                {
                    aliasname += "/" + segments[0];
                }
                if (aliasname.EndsWith("/"))
                {
                    aliasname = aliasname.Substring(0, aliasname.Length - 1);
                }
            }
        }
コード例 #33
0
        public UserServsiceTest()
        {
            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new AutoMapping());
            });

            _unitOfWork     = new UnitOfWork("Server=localhost;Port=3306;User Id=root;Database=tenantdb");
            _userRepository = new UserRepository(_unitOfWork);
            _mapper         = mappingConfig.CreateMapper();

            _context = new DefaultHttpContext();

            _httpContextAccessor             = new HttpContextAccessor();
            _httpContextAccessor.HttpContext = _context;
            var hostString = new HostString("http://localhost:5000", 5000);

            _httpContextAccessor.HttpContext.Request.Host = hostString;
            _tenantRepository  = new TenantRepository(_unitOfWork);
            _tenantService     = new TenantService(_tenantRepository, _mapper);
            _userService       = new UserService(_userRepository, _mapper);
            _authAPIController = new AuthAPIController(_httpContextAccessor, _tenantService, _userService);
        }
コード例 #34
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public PreprocessingController(
     IPreprocessRepository preprocessRepository,
     IPreprocessHistoryRepository preprocessHistoryRepository,
     ITenantRepository tenantRepository,
     IDataRepository dataRepository,
     IPreprocessLogic preprocessLogic,
     ITagLogic tagLogic,
     IGitLogic gitLogic,
     IStorageLogic storageLogic,
     IClusterManagementLogic clusterManagementLogic,
     IUnitOfWork unitOfWork,
     IHttpContextAccessor accessor) : base(accessor)
 {
     this.preprocessRepository        = preprocessRepository;
     this.preprocessHistoryRepository = preprocessHistoryRepository;
     this.tenantRepository            = tenantRepository;
     this.dataRepository         = dataRepository;
     this.preprocessLogic        = preprocessLogic;
     this.tagLogic               = tagLogic;
     this.gitLogic               = gitLogic;
     this.storageLogic           = storageLogic;
     this.clusterManagementLogic = clusterManagementLogic;
     this.unitOfWork             = unitOfWork;
 }
コード例 #35
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public InferenceController(
     ITrainingHistoryRepository trainingHistoryRepository,
     IInferenceHistoryRepository inferenceHistoryRepository,
     IDataSetRepository dataSetRepository,
     ITenantRepository tenantRepository,
     INodeRepository nodeRepository,
     IInferenceLogic inferenceLogic,
     IStorageLogic storageLogic,
     IGitLogic gitLogic,
     IClusterManagementLogic clusterManagementLogic,
     IUnitOfWork unitOfWork,
     IHttpContextAccessor accessor) : base(accessor)
 {
     this.trainingHistoryRepository  = trainingHistoryRepository;
     this.inferenceHistoryRepository = inferenceHistoryRepository;
     this.dataSetRepository          = dataSetRepository;
     this.tenantRepository           = tenantRepository;
     this.nodeRepository             = nodeRepository;
     this.inferenceLogic             = inferenceLogic;
     this.storageLogic           = storageLogic;
     this.gitLogic               = gitLogic;
     this.clusterManagementLogic = clusterManagementLogic;
     this.unitOfWork             = unitOfWork;
 }
コード例 #36
0
 /// <summary>
 /// 初始化站点管理器
 /// </summary>
 /// <param name="tenantRepository">租户仓储</param>
 protected SiteManagerBase( ITenantRepository tenantRepository ) {
     TenantRepository = tenantRepository;
 }
コード例 #37
0
 public PropertySignRequestManager(IPropertySignRequestRepository repository, ITenantRepository tenantRepository)
 {
     _repository = repository;
     _tenantRepository = tenantRepository;
 }
コード例 #38
0
 public TLoginUpPartyController(TelemetryScopedLogger logger, IMapper mapper, ITenantRepository tenantRepository, ValidateGenericPartyLogic validateGenericPartyLogic, ValidateLoginPartyLogic validateLoginPartyLogic) : base(logger, mapper, tenantRepository, validateGenericPartyLogic)
 {
     this.validateLoginPartyLogic = validateLoginPartyLogic;
 }
コード例 #39
0
 public TenantService(ITenantRepository repository)
 {
     _repository = repository;
 }
コード例 #40
0
 /// <summary>
 /// 初始化应用程序管理器
 /// </summary>
 /// <param name="applicationRepository">应用程序仓储</param>
 /// <param name="tenantRepository">租户仓储</param>
 public ApplicationManager(IApplicationRepository applicationRepository, ITenantRepository tenantRepository)
 {
     ApplicationRepository = applicationRepository;
     TenantRepository = tenantRepository;
 }
コード例 #41
0
 public IdentityApplicationService(ITenantRepository tenantRepository)
 {
     _tenantRepository = tenantRepository;
 }
コード例 #42
0
 public RouteBasedTenantResolverService(ITenantRepository tenants)
 {
     _tenants = tenants;
 }
コード例 #43
0
ファイル: SiteManager.cs プロジェクト: BeiMeng/GitApplication
 /// <summary>
 /// 初始化站点管理器
 /// </summary>
 /// <param name="tenantRepository">租户仓储</param>
 public SiteManager( ITenantRepository tenantRepository )
     : base( tenantRepository ) {
 }
コード例 #44
0
        public async Task <IActionResult> CreateForAdmin([FromBody] CreateInputModel model, [FromServices] ITenantRepository tenantRepository)
        {
            // データの入力チェック
            if (!ModelState.IsValid)
            {
                return(JsonBadRequest("Invalid inputs."));
            }

            if (model.IsSystemRole && model.TenantId != null)
            {
                // Admin向けなのにテナント固有にしてあったら入力ミス
                return(JsonBadRequest($"Invalid inputs. the role is for admin, but set to specific tenant { model.TenantId }"));
            }

            // データの存在チェック
            if (model.TenantId != null && tenantRepository.Get(model.TenantId.Value) == null)
            {
                return(JsonNotFound($"Tenant ID {model.TenantId.Value} is not found."));
            }

            return(await CreateAsync(model));
        }
コード例 #45
0
 public TenantService(ITenantRepository tenantRepository)
 {
     this._tenantRepository = tenantRepository;
 }
コード例 #46
0
 public TenantService(ITenantRepository repository) : base(repository)
 {
     _repository = repository;
 }
コード例 #47
0
 public HostBasedTenantResolverService(ITenantRepository tenants)
 {
     _tenants = tenants;
     _hosts = new Dictionary<string,Tenant>();
 }