예제 #1
0
        public SanityTests()
        {
            _petsManagementService         = ServiceProvider.Instance.Resolve <IPetsManagementService>();
            _petsStatusManagementService   = ServiceProvider.Instance.Resolve <IPetsStatusManagementService>();
            _newsManagementService         = ServiceProvider.Instance.Resolve <INewsManagementService>();
            _userManagementService         = ServiceProvider.Instance.Resolve <IUsersManagementService>();
            _filesManagementService        = ServiceProvider.Instance.Resolve <IFilesManagementService>();
            _organizationManagementService = ServiceProvider.Instance.Resolve <IOrganizationManagementService>();
            _proposalsManagementService    = ServiceProvider.Instance.Resolve <IProposalsManagementService>();
            _howToHelpInformationService   = ServiceProvider.Instance.Resolve <IHowToHelpInformationService>();
            _accountManagementService      = ServiceProvider.Instance.Resolve <IAccountManagementService>();
            _helpersManagementService      = ServiceProvider.Instance.Resolve <IHelpersManagementService>();
            _commentsManagementService     = ServiceProvider.Instance.Resolve <ICommentsManagementService>();

            _petsManagementService.RequestUri               = RequestUriHelper.PetsUri;
            _petsStatusManagementService.RequestUri         = RequestUriHelper.PetsStatusUri;
            _newsManagementService.RequestUri               = RequestUriHelper.NewsUri;
            _userManagementService.RequestUri               = RequestUriHelper.UsersUri;
            _organizationManagementService.RequestUri       = RequestUriHelper.OrganizationInfoUri;
            _proposalsManagementService.RequestUri          = RequestUriHelper.ProposalsUri;
            _howToHelpInformationService.BecomeVolunteerUrl = RequestUriHelper.HowToHelpUri;
            _howToHelpInformationService.DonateInfoUrl      = RequestUriHelper.HowToHelpUri;
            _accountManagementService.RequestUri            = RequestUriHelper.JwtTokenUri;
            _helpersManagementService.RequestUri            = RequestUriHelper.HelpersUri;
            _commentsManagementService.RequestUri           = RequestUriHelper.CommentsUri;
        }
예제 #2
0
파일: Reservation.cs 프로젝트: ddumic/forms
 public Reservation(IAccountManagementService accountManagementService, IBandManagementService bandManagementService)
 {
     InitializeComponent();
     _accountManagementService = accountManagementService;
     _bandManagementService    = bandManagementService;
     GetAllReservations();
 }
예제 #3
0
파일: Home.cs 프로젝트: ddumic/forms
 public Home(IAccountManagementService accountManagementService, IBandManagementService bandManagementService)
 {
     InitializeComponent();
     _accountManagementService = accountManagementService;
     _bandManagementService    = bandManagementService;
     GetAllBands();
 }
예제 #4
0
        public RegistrationPresenter(
            IRegisterView view,
            IRegistrationService registrationService,
            ISubjectManagementService subjectManagementService,
            IClassOfStudentsManagementService classOfStudentsManagementService,
            IAccountManagementService accountManagementSerivce,
            IEmailSenderService emailSender,
            IPasswordGeneratorService passwordService)
            : base(view)
        {
            Guard.WhenArgument(registrationService, "registrationService").IsNull().Throw();
            Guard.WhenArgument(subjectManagementService, "subjectManagementService").IsNull().Throw();
            Guard.WhenArgument(classOfStudentsManagementService, "classOfStudentsManagementService").IsNull().Throw();
            Guard.WhenArgument(accountManagementSerivce, "accountManagementService").IsNull().Throw();
            Guard.WhenArgument(emailSender, "emailSender").IsNull().Throw();
            Guard.WhenArgument(passwordService, "passwordService").IsNull().Throw();

            this.registrationService              = registrationService;
            this.accountManagementSerivce         = accountManagementSerivce;
            this.subjectManagementService         = subjectManagementService;
            this.classOfStudentsManagementService = classOfStudentsManagementService;
            this.emailSender     = emailSender;
            this.passwordService = passwordService;

            this.View.EventRegisterUser         += this.RegisterUser;
            this.View.EventGetClassesOfStudents += this.View_EventGetClassesOfStudents;
            this.View.EventGetUserRoles         += this.View_EventGetUserRoles;
            this.View.EventGetAvailableSubjects += this.View_EventGetAvailableSubjects;
        }
예제 #5
0
        private void attachUserToContext(HttpContext context, IAccountManagementService AccountManagementServices, string token)
        {
            try
            {
                var tokenHandler = new JwtSecurityTokenHandler();
                var key          = Encoding.ASCII.GetBytes(_appSettings.Secret);
                tokenHandler.ValidateToken(token, new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(key),
                    ValidateIssuer           = false,
                    ValidateAudience         = false,
                    // set clockskew to zero so tokens expire exactly at token expiration time (instead of 5 minutes later)
                    ClockSkew = TimeSpan.Zero
                }, out SecurityToken validatedToken);

                var jwtToken = (JwtSecurityToken)validatedToken;
                var userId   = int.Parse(jwtToken.Claims.First(x => x.Type == "id").Value);

                // attach user to context on successful jwt validation
                context.Items["User"] = AccountManagementServices.GetById(userId);
            }
            catch
            {
                // do nothing if jwt validation fails
                // user is not attached to context so request won't have access to secure routes
            }
        }
        public AccountManagementController(IAccountManagementService AccountManagement, IOptions <EmailSender> appSettings, IOptions <Default_Url> settings)
        {
            _AccountManagementService = AccountManagement;

            email = appSettings.Value;
            url   = settings.Value;
        }
 public TemporaryCapitalController(
     IAccountManagementService accountManagementService,
     IAccuracyService accuracyService)
 {
     _accountManagementService = accountManagementService;
     _accuracyService          = accuracyService;
 }
예제 #8
0
 private AllAccountsInfo ListAllRoles()
 {
     using (var scope = WebHost.Services.CreateScope()) {
         var services = scope.ServiceProvider;
         manager = services.GetService <IAccountManagementService>();
         return(manager.ListAllUsers());
     }
 }
예제 #9
0
 public CleanupExpiredComplexityService(IFeatureManager featureManager, ILog log, AccountManagementSettings settings, IAccountManagementService accountManagementService, IComplexityWarningRepository complexityWarningRepository)
 {
     _featureManager              = featureManager;
     _log                         = log;
     _settings                    = settings;
     _accountManagementService    = accountManagementService;
     _complexityWarningRepository = complexityWarningRepository;
 }
예제 #10
0
 public FrmClan(IAccountManagementService accountManagementService, IBandMemberManagementService bandMemberManagementService)
 {
     InitializeComponent();
     _accountManagementService    = accountManagementService;
     _bandMemberManagementService = bandMemberManagementService;
     GetMembers();
     GetAvailableAccounts();
 }
예제 #11
0
 private YearApPermissionLevels GetUserRole(string userEmail)
 {
     using (var scope = WebHost.Services.CreateScope()) {
         var services = scope.ServiceProvider;
         manager = services.GetService <IAccountManagementService>();
         return(manager.GetAccountInfoByEmail(userEmail).Role);
     }
 }
예제 #12
0
 public NewsManagementTest()
 {
     _newsManagementService                  = ServiceProvider.Instance.Resolve <INewsManagementService>();
     _accountManagementService               = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _newsManagementService.RequestUri       = RequestUriHelper.NewsUri;
     _accountManagementService.RequestUriJwt = RequestUriHelper.JwtTokenUri;
     _testingNews = TestingObjectProvider.Instance.News;
     _token       = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
예제 #13
0
        public void ThrowArgumentNulLException_WhenAccountManagementService_IsNull()
        {
            // Arrange
            IAccountManagementService accountManagementService = null;

            // Act and Assert
            Assert.That(() => new HomeController(accountManagementService),
                        Throws.ArgumentNullException.With.Message.Contain(nameof(accountManagementService)));
        }
예제 #14
0
 public ExecutiveSummaryViewModel(
     ITextTranslator textTranslator,
     IAccountManagementService accountService,
     IItemReferences itemReferences)
 {
     TextTranslator = textTranslator;
     AccountService = accountService;
     ItemReferences = itemReferences;
 }
 public HelpersManagementTests()
 {
     _helpersManagementService            = ServiceProvider.Instance.Resolve <IHelpersManagementService>();
     _accountManagementService            = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _helpersManagementService.RequestUri = RequestUriHelper.HelpersUri;
     _accountManagementService.RequestUri = RequestUriHelper.JwtTokenUri;
     _testingHelper = TestingObjectProvider.Instance.Helper;
     _token         = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
 public PetsStatusManagementTest()
 {
     _petsStatusManagementService            = ServiceProvider.Instance.Resolve <IPetsStatusManagementService>();
     _accountManagementService               = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _petsStatusManagementService.RequestUri = RequestUriHelper.PetsStatusUri;
     _accountManagementService.RequestUri    = RequestUriHelper.JwtTokenUri;
     _testingStatus = TestingObjectProvider.Instance.PetsStatus;
     _token         = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
예제 #17
0
 public OrganizationInfoManagementTest()
 {
     _organizationInfoManagementService            = ServiceProvider.Instance.Resolve <IOrganizationManagementService>();
     _accountManagementService                     = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _organizationInfoManagementService.RequestUri = RequestUriHelper.OrganizationInfoUri;
     _accountManagementService.RequestUri          = RequestUriHelper.JwtTokenUri;
     _testingOrganization = TestingObjectProvider.Instance.Organization;
     _token = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
예제 #18
0
 public CommentsManagementTests()
 {
     _commentsManagementService            = ServiceProvider.Instance.Resolve <ICommentsManagementService>();
     _accountManagementService             = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _commentsManagementService.RequestUri = RequestUriHelper.CommentsUri;
     _accountManagementService.RequestUri  = RequestUriHelper.JwtTokenUri;
     _testingComment = TestingObjectProvider.Instance.Comment;
     _token          = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
예제 #19
0
 public UserManagementTest()
 {
     _userManagementService                  = ServiceProvider.Instance.Resolve <IUsersManagementService>();
     _accountManagementService               = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _userManagementService.RequestUri       = RequestUriHelper.UsersUri;
     _accountManagementService.RequestUriJwt = RequestUriHelper.JwtTokenUri;
     _testUser = TestingObjectProvider.Instance.User;
     _token    = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
예제 #20
0
 public ProposalsManagementTests()
 {
     _proposalsManagementService             = ServiceProvider.Instance.Resolve <IProposalsManagementService>();
     _accountManagementService               = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _proposalsManagementService.RequestUri  = RequestUriHelper.ProposalsUri;
     _accountManagementService.RequestUriJwt = RequestUriHelper.JwtTokenUri;
     _testingProposal = TestingObjectProvider.Instance.Proposal;
     _token           = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
 public CounterpartyManagementService(EdoContext context,
                                      IDateTimeProvider dateTimeProvider,
                                      IManagementAuditService managementAuditService,
                                      IAccountManagementService accountManagementService)
 {
     _context                  = context;
     _dateTimeProvider         = dateTimeProvider;
     _managementAuditService   = managementAuditService;
     _accountManagementService = accountManagementService;
 }
예제 #22
0
 public ITController(IDoctorRepository doctorRepository,
                     IStaffRepository staffRepository,
                     IAccountRepository accountRepository,
                     IAccountManagementService accountManagementService)
 {
     _doctorRepository         = doctorRepository;
     _staffRepository          = staffRepository;
     _accountRepository        = accountRepository;
     _accountManagementService = accountManagementService;
 }
 public HotToHelpInfoManagementTests()
 {
     _howToHelpInformationService = ServiceProvider.Instance.Resolve <IHowToHelpInformationService>();
     _accountManagementService    = ServiceProvider.Instance.Resolve <IAccountManagementService>();
     _howToHelpInformationService.BecomeVolunteerUrl = RequestUriHelper.OrganizationInfoUri;
     _howToHelpInformationService.DonateInfoUrl      = RequestUriHelper.HowToHelpUri;
     _accountManagementService.RequestUri            = RequestUriHelper.JwtTokenUri;
     _testingObject = TestingObjectProvider.Instance.HowToHelpInfo;
     _token         = _accountManagementService.SignIn(TestingObjectProvider.Instance.Login).Result;
 }
예제 #24
0
        public CustomAuthorizationMiddleware(RequestDelegate next, IOptions <AppSettings> appSettings, IHostingEnvironment env, IAuthService cookieService, IAccountManagementService accountManagementService)
        {
            _next        = next;
            _appSettings = appSettings.Value;
            _env         = env;
            _authService = cookieService;
            _accountManagementService = accountManagementService;

            _blockedControllers = appSettings.Value.BlockedControllers;
        }
예제 #25
0
        public async Task Invoke(HttpContext context, IAccountManagementService AccountManagementServices)
        {
            var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();

            if (token != null)
            {
                attachUserToContext(context, AccountManagementServices, token);
            }

            await _next(context);
        }
예제 #26
0
 public AgencyVerificationService(EdoContext context, IAccountManagementService accountManagementService,
                                  IManagementAuditService managementAuditService, INotificationService notificationService,
                                  IDateTimeProvider dateTimeProvider, Services.Agents.IAgentService agentService)
 {
     _context = context;
     _accountManagementService = accountManagementService;
     _managementAuditService   = managementAuditService;
     _notificationService      = notificationService;
     _dateTimeProvider         = dateTimeProvider;
     _agentService             = agentService;
 }
예제 #27
0
 public DbInitializer(
     ApplicationDbContext dbContext,
     IAccountManagementService accountManager,
     IConfiguration configuration,
     IEmailService emailService)
 {
     _dbContext      = dbContext;
     _configuration  = configuration;
     _accountManager = accountManager;
     _emailService   = emailService;
 }
예제 #28
0
        public AvatarUploadPresenter(
            IAvatarUploadView view,
            IAccountManagementService accountManagementService)
            : base(view)
        {
            Guard.WhenArgument(accountManagementService, "accountManagementService").IsNull().Throw();

            this.accountManagementService = accountManagementService;

            this.View.EventUploadAvatar  += this.View_EventUploadAvatar;
            this.View.EventGetUserAvatar += this.View_EventGetUserAvatar;
        }
 public WithdrawalCommandsHandler(
     ISystemClock systemClock,
     IAccountsRepository accountsRepository,
     IOperationExecutionInfoRepository executionInfoRepository,
     IChaosKitty chaosKitty,
     IAccountManagementService accountManagementService)
 {
     _systemClock             = systemClock;
     _executionInfoRepository = executionInfoRepository;
     _accountsRepository      = accountsRepository;
     _chaosKitty = chaosKitty;
     _accountManagementService = accountManagementService;
 }
예제 #30
0
        public UsersController(
            IAccountManagementService accountManagementService,
            IMappingProvider mappingProvider,
            IAuthService authService)
        {
            Guard.WhenArgument(accountManagementService, nameof(accountManagementService)).IsNull().Throw();
            Guard.WhenArgument(mappingProvider, nameof(mappingProvider)).IsNull().Throw();
            Guard.WhenArgument(authService, nameof(authService)).IsNull().Throw();

            this.accountManagementService = accountManagementService;
            this.authService     = authService;
            this.mappingProvider = mappingProvider;
        }
        public void Initialize()
        {
            managementService = new AccountManagementService();
            accountAdministrationService = new AccountAdministrationService();

            userInformationServiceMock = _factory.CreateMock<IUserInformationService>();
            accountAdministrationDaoMock = _factory.CreateMock<IAccountAdministrationDao>();
            authorizationServiceMock = _factory.CreateMock<IAuthorizationService>();
            accountAdministrationServiceMock = _factory.CreateMock<IAccountAdministrationService>();
            userInformationDaoMock = _factory.CreateMock<IUserInformationDao>();

            managementService.UserInformationDao = userInformationDaoMock.MockObject;
            userInformationService = userInformationServiceMock.MockObject;
            managementService.UserInformationService = userInformationService;
            managementService.AccountAdministrationDao = accountAdministrationDaoMock.MockObject;
            accountAdministrationService.AccountAdministrationDao = accountAdministrationDaoMock.MockObject;
            managementService.AuthorizationService = authorizationServiceMock.MockObject;
            managementService.AccountAdministrationService = accountAdministrationServiceMock.MockObject;
            helper.UserAccountHelper(userAccount);
            //accountAdministrationService.SaveOrUpdateUser(userAccount);
            userAccountId = userAccount.Id;
        }
 public AccountController(IAccountManagementService accountManagementService)
 {
     _accountManagementService = accountManagementService;
 }