示例#1
0
        public StudentRepositoryTests()
        {
            _container = new SimpleInjectorContainer();
            _container.RegisterDependencies();
            _studentRepository = _container.GetInstance <IStudentRepository>();
            _uow = _container.GetInstance <IUnitOfWork>();

            _name    = new Name("Vivi", "Pode subir");
            _address = new Address("Brasil", "SP", "Sorocaba", "Teste", "Rua A", 50, "");
            _email   = new Email("*****@*****.**");
            _student = new Student(Guid.NewGuid(), _name, _address, _email, "(15)98011-1551");
        }
        public override Task ValidateIdentity(CookieValidateIdentityContext context)
        {
            var validated = false;

            var identity = context.Identity;

            if (identity == null)
            {
                // Clear the identity.
                context.RejectIdentity();
                return(Task.FromResult <object>(null));
            }

            var userLogin   = GetClaimValue(identity, ClaimTypes.NameIdentifier);
            var culturename = GetClaimValue(identity, AuthenticationConstants.OwinContextCultureName);

            var peopleService = SimpleInjectorContainer.GetInstance <IPeopleService>();
            var user          = peopleService.GetByLogin(userLogin);

            validated = (user != null);

            if (!validated)
            {
                context.RejectIdentity();
                return(Task.FromResult <object>(null));
            }

            var nIdentity = peopleService.ValidateAndCreateClaim(user, AuthenticationType, context.Properties.Dictionary);

            context.OwinContext.Set <ClaimsIdentity>(AuthenticationConstants.EnscoIdentity, nIdentity);

            context.OwinContext.Set <string>(AuthenticationConstants.OwinContextCultureName, culturename);

            return(base.ValidateIdentity(context));
        }
示例#3
0
        public GamePlatformController()
        {
            var service = SimpleInjectorContainer.GetInstance <IGamePlatformRepository>();

            _repo = (IGamePlatformRepository)service;
        }
        public UserController()
        {
            var service = SimpleInjectorContainer.GetInstance <IUserRepository>();

            _repo = (IUserRepository)service;
        }