Esempio n. 1
0
        private HashedByteIdGenerator GetSut(IFastHasher hasher = null, ISafeRandom random = null,
                                             IMemoryProtectedBytes sessionSalt = null)
        {
            if (hasher == null)
            {
                var mockHasher = new Mock <IFastHasher>();
                mockHasher.Setup(m => m.ComputeFast(It.IsAny <byte[]>()))
#if !(NETCOREAPP3_1 || NETCOREAPP3_0)
                .Returns((byte[] b) => b[b.Length - 1]);
 private HashedByteIdGenerator GetSut(IFastHasher hasher = null, ISafeRandom random = null, IByteArrayProtector protector = null)
 {
     if (hasher == null)
     {
         var mockHasher = new Mock <IFastHasher>();
         mockHasher.Setup(m => m.ComputeFast(It.IsAny <byte[]>())).Returns((byte[] b) => b[b.Length - 1]);
         hasher = mockHasher.Object;
     }
     return(new HashedByteIdGenerator(hasher, random ?? Stubs.Get <ISafeRandom>(), protector ?? Mock.Of <IByteArrayProtector>()));
 }
 public PathProvider(IFastHasher hasher, IOptions <AppSetting> options)
 {
     _hasher     = hasher;
     _appSetting = options.Value;
     if (_appSetting.ApiBaseUrl.EndsWith("/"))
     {
         _appSetting.ApiBaseUrl =
             _appSetting.ApiBaseUrl.Substring(0, _appSetting.ApiBaseUrl.Length - 1);
     }
 }
Esempio n. 4
0
 internal HashedByteIdGenerator(IFastHasher fastHasher, ISafeRandom safeRandom,
                                IMemoryProtectedBytes sessionSalt)
 {
     if (sessionSalt == null)
     {
         throw new ArgumentNullException(nameof(sessionSalt));
     }
     _fastHasher  = fastHasher ?? throw new ArgumentNullException(nameof(fastHasher));
     _safeRandom  = safeRandom ?? throw new ArgumentNullException(nameof(safeRandom));
     _sessionSalt = new AsyncLazy <IMemoryProtectedBytes>(() => InitializeSaltAsync(sessionSalt));
 }
 public AppAuthService(IEntityService <UserAccount> entityService, IEntityService <RealEstate> estateEntityService, IOptions <AuthSetting> authOptions,
                       IOptions <AppSetting> appOptions, IPasswordService passwordService, IFastHasher hasher, IUserGroupProvider groupProvider)
 {
     _entityService       = entityService;
     _estateEntityService = estateEntityService;
     _passwordService     = passwordService;
     _hasher        = hasher;
     _groupProvider = groupProvider;
     _authSetting   = authOptions.Value;
     _appSetting    = appOptions.Value;
 }
Esempio n. 6
0
        public UserAccountController(IModelService <UserAccount, UserAccountDto> modelService,
                                     IUserProvider userProvider, IUserGroupProvider groupProvider, IFastHasher fastHasher, IUploadHelperService uploadHelperService, IPathProvider pathProvider) : base(modelService)
        {
            _userProvider        = userProvider;
            _uploadHelperService = uploadHelperService;
            _pathProvider        = pathProvider;
            _fastHasher          = fastHasher;
            _groupProvider       = groupProvider;
            var administratorGroupId = groupProvider[UserGroup.Administrator].Id;

            modelService.SetBaseFilter(i => i.Where(u => u.IsActive == true && u.UserAccountGroup.FirstOrDefault(g => g.UserAccountId == u.Id).UserGroupId
                                                    != administratorGroupId));
        }
 public AgentController(IModelService <Agent, AgentDto> modelService,
                        IEntityService <UserAccount> userAccountService,
                        IEntityService <Agent> agentService,
                        IFastHasher fastHasher,
                        IUserProvider userProvider,
                        IPasswordService passwordService,
                        IPathProvider pathProvider) : base(modelService)
 {
     _userAccountService = userAccountService;
     _agentService       = agentService;
     _fastHasher         = fastHasher;
     _userProvider       = userProvider;
     _passwordService    = passwordService;
     _pathProvider       = pathProvider;
     modelService.SetBaseFilter(filter => filter.Where(a => a.RealEstateId == _userProvider.RealEstateId && !a.Deleted && a.UserAccount.IsActive != false));
 }
 public RequestController(IModelService <Request, RequestDto> modelService, IFastHasher hasher,
                          IUserProvider userProvider, IEntityService <RequestState> requestStateService, IEntityService <RequestAgent> requestAgentService,
                          IEntityService <Property> propertyService, IEntityService <Workflow> workflowService, IEntityService <WorkflowStep> workflowStepService,
                          IUpdateSignaler signaler, IEntityService <UserAccount> userAccountService)
     : base(modelService)
 {
     _hasher              = hasher;
     _userProvider        = userProvider;
     _requestStateService = requestStateService;
     _requestAgentService = requestAgentService;
     _propertyService     = propertyService;
     _workflowService     = workflowService;
     _workflowStepService = workflowStepService;
     _signaler            = signaler;
     _userAccountService  = userAccountService;
 }
Esempio n. 9
0
 internal HashedByteIdGenerator(IFastHasher fastHasher, ISafeRandom safeRandom,
                                IByteArrayProtector memoryProtector)
 {
     if (fastHasher == null)
     {
         throw new ArgumentNullException(nameof(fastHasher));
     }
     if (safeRandom == null)
     {
         throw new ArgumentNullException(nameof(safeRandom));
     }
     if (memoryProtector == null)
     {
         throw new ArgumentNullException(nameof(memoryProtector));
     }
     _fastHasher      = fastHasher;
     _safeRandom      = safeRandom;
     _memoryProtector = memoryProtector;
 }
Esempio n. 10
0
 internal StateStamper(ISerializer serializer, IFastHasher fastHasher) : base(fastHasher)
 {
     _serializer = serializer;
 }
Esempio n. 11
0
 protected StamperBase(IFastHasher fastHasher)
 {
     _fastHasher = fastHasher;
 }
Esempio n. 12
0
 internal IlCodeStamper(IFastHasher fastHasher) : base(fastHasher)
 {
 }
 public UploadHelperService(IFileService fileService, IImageService imageService, IFastHasher hasher)
 {
     _hasher      = hasher;
     FileService  = fileService;
     ImageService = imageService;
 }