当前位置: 首页>>代码示例>>C#>>正文


C# IUserAuthRepository类代码示例

本文整理汇总了C#中IUserAuthRepository的典型用法代码示例。如果您正苦于以下问题:C# IUserAuthRepository类的具体用法?C# IUserAuthRepository怎么用?C# IUserAuthRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IUserAuthRepository类属于命名空间,在下文中一共展示了IUserAuthRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveUserAuth

        /// <summary>
        /// Saves the Auth Tokens for this request. Called in OnAuthenticated(). 
        /// Overrideable, the default behaviour is to call IUserAuthRepository.CreateOrMergeAuthSession().
        /// </summary>
        protected virtual void SaveUserAuth(IServiceBase authService, IAuthSession session, IUserAuthRepository authRepo, IOAuthTokens tokens)
        {
            if (authRepo == null) return;
            if (tokens != null)
            {
                session.UserAuthId = authRepo.CreateOrMergeAuthSession(session, tokens);
            }

            authRepo.LoadUserAuth(session, tokens);

            foreach (var oAuthToken in session.ProviderOAuthAccess)
            {
                var authProvider = AuthService.GetAuthProvider(oAuthToken.Provider);
                if (authProvider == null) continue;
                var userAuthProvider = authProvider as OAuthProvider;
                if (userAuthProvider != null)
                {
                    userAuthProvider.LoadUserOAuthProvider(session, oAuthToken);
                }
            }

            authRepo.SaveUserAuth(session);

            var httpRes = authService.RequestContext.Get<IHttpResponse>();
            if (httpRes != null)
            {
                httpRes.Cookies.AddPermanentCookie(HttpHeaders.XUserAuthId, session.UserAuthId);
            }
            OnSaveUserAuth(authService, session);
        }
开发者ID:yeurch,项目名称:ServiceStack,代码行数:34,代码来源:AuthProvider.cs

示例2: OrderController

 public OrderController(IOrderRepository orderRepo,
     IUserAuthRepository userAuthRepo,
     ICustomerRepository customerRepo,
     IOrderLogRepository orderLogRepo,
     IOrderItemRepository orderItemRepo,
     IInboundPackRepository inboundRepo,
     IOutboundRepository outboundRepo,
     IOutboundItemRepository outbounditemRepo,
     ISectionRepository sectionRepo,
     IRMARepository rmaRepo,
     IRMALogRepository rmalogRepo,
     IRMAItemRepository rmaitemRepo
     )
 {
     _orderRepo = orderRepo;
     _userAuthRepo = userAuthRepo;
     _customerRepo = customerRepo;
     _orderLogRepo = orderLogRepo;
     _orderItemRepo = orderItemRepo;
     _inboundRepo = inboundRepo;
     _outboundRepo = outboundRepo;
     _outbounditemRepo = outbounditemRepo;
     _sectionRepo = sectionRepo;
     _rmaRepo = rmaRepo;
     _rmalogRepo = rmalogRepo;
     _rmaitemRepo = rmaitemRepo;
 }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:27,代码来源:OrderController.cs

示例3: CreateUser

 private static void CreateUser(IUserAuthRepository userRepo, IUserAuth user, string password)
 {
     string hash;
     string salt;
     new SaltedHash().GetHashAndSaltString(password, out hash, out salt);
     user.Salt = salt;
     user.PasswordHash = hash;
     userRepo.CreateUserAuth(user, password);
 }
开发者ID:ryandavidhartman,项目名称:Auth202,代码行数:9,代码来源:DataBaseHelper.cs

示例4: Can_AutoLogin_whilst_Registering

        public void Can_AutoLogin_whilst_Registering(IUserAuthRepository userAuthRepository)
        {
            InitTest(userAuthRepository);
            var oAuthUserSession = requestContext.ReloadSession();
            registrationDto.AutoLogin = true;
            Register(userAuthRepository, oAuthUserSession, registrationDto);

            oAuthUserSession = requestContext.ReloadSession();
            Assert.That(oAuthUserSession.IsAuthenticated, Is.True);
        }
开发者ID:nstjelja,项目名称:ServiceStack,代码行数:10,代码来源:OAuthUserSessionTests.cs

示例5: UserAuthController

 public UserAuthController(IUserAuthRepository authRepo
     ,IStoreRepository storeRepo
     ,IBrandRepository brandRepo
     ,ICustomerRepository customerRepo)
 {
     _authRepo = authRepo;
     _storeRepo = storeRepo;
     _brandRep = brandRepo;
     _customerRepo = customerRepo;
    
 }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:11,代码来源:UserAuthController.cs

示例6: PromotionController

 public PromotionController(IPromotionRepository promotionRepository
     ,IStoreRepository storeRepository
     ,ITagRepository tagRepository
     ,IResourceService resourceService
     ,IUserAuthRepository authRepo)
 {
     this._promotionRepository = promotionRepository;
     _storeRepository = storeRepository;
     _tagRepository = tagRepository;
     _resourceService = resourceService;
     _authRepo = authRepo;
 }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:12,代码来源:PromotionController.cs

示例7: GetRegistrationService

 public static RegistrationService GetRegistrationService(
     AbstractValidator<Registration> validator = null,
     IUserAuthRepository authRepo=null)
 {
     var requestContext = new MockRequestContext();
     var service = new RegistrationService {
         RegistrationValidator = validator ?? new RegistrationValidator { UserAuthRepo = GetStubRepo() },
         UserAuthRepo = authRepo ?? GetStubRepo(),
         RequestContext = requestContext
     };
     return service;
 }
开发者ID:nstjelja,项目名称:ServiceStack,代码行数:12,代码来源:RegistrationServiceTests.cs

示例8: HasAllRoles

        public bool HasAllRoles(IHttpRequest req, IAuthSession session, IUserAuthRepository userAuthRepo=null)
        {
            if (HasAllRoles(session)) return true;

            session.UpdateFromUserAuthRepo(req, userAuthRepo);

            if (HasAllRoles(session))
            {
                req.SaveSession(session);
                return true;
            }
            return false;
        }
开发者ID:grammarware,项目名称:fodder,代码行数:13,代码来源:src_ServiceStack_ServiceInterface_RequiredRoleAttribute.cs

示例9: ProductController

 public ProductController(IProductRepository productRepository
     , ISpecialTopicProductRelationRepository specialTopicProductRelationRepository
     , IPromotionProductRelationRepository promotionProductRelationRepository
     , IStoreRepository storeRepository
     , IResourceService resourceService
     , IUserAuthRepository userAuthRepo)
 {
     _productRepository = productRepository;
     _stprRepository = specialTopicProductRelationRepository;
     _pprRepository = promotionProductRelationRepository;
     _storeRepository = storeRepository;
     _resourceService = resourceService;
     _userAuthRepo = userAuthRepo;
 }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:14,代码来源:ProductController.cs

示例10: OrderController

 public OrderController(IOrderRepository orderRepo,
     IUserAuthRepository userAuthRepo,
     ICustomerRepository customerRepo,
     IOrderLogRepository orderLogRepo,
     IOrderItemRepository orderItemRepo,
     IInboundPackRepository inboundRepo)
 {
     _orderRepo = orderRepo;
     _userAuthRepo = userAuthRepo;
     _customerRepo = customerRepo;
     _orderLogRepo = orderLogRepo;
     _orderItemRepo = orderItemRepo;
     _inboundRepo = inboundRepo;
 }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:14,代码来源:OrderController.cs

示例11: ProductPropertyValueController

 public ProductPropertyValueController(ITagRepository tagRepo,
     ICategoryPropertyRepository tagpropertyRepo,
     ICategoryPropertyValueRepository tagpropertyvalRepo,
     IProductPropertyValueRepository prodpropertyvalRepo,
     IProductPropertyRepository prodpropertyRepo,
     IProductRepository prodRepo,
     IUserAuthRepository userauthRepo
 )
 {
     _tagRepo = tagRepo;
     _tagpropertyRepo = tagpropertyRepo;
     _tagpropertyvalueRepo = tagpropertyvalRepo;
     _prodpropertyRepo = prodpropertyRepo;
     _prodpropertyvalRepo = prodpropertyvalRepo;
     _prodRepo = prodRepo;
     _userauthRepo = userauthRepo;
 }
开发者ID:huayumeng,项目名称:ytoo.service,代码行数:17,代码来源:ProductPropertyValueController.cs

示例12: Connecting_to_facebook_whilst_authenticated_connects_account

        public void Connecting_to_facebook_whilst_authenticated_connects_account(IUserAuthRepository userAuthRepository)
        {
            InitTest(userAuthRepository);

            var oAuthUserSession = requestContext.ReloadSession();

            oAuthUserSession = RegisterAndLogin(userAuthRepository, oAuthUserSession);

            LoginWithFacebook(oAuthUserSession);

            var userAuth = userAuthRepository.GetUserAuthByUserName(registrationDto.UserName);

            Assert.That(userAuth.UserName, Is.EqualTo(registrationDto.UserName));

            var userAuthProviders = userAuthRepository.GetUserOAuthProviders(userAuth.Id.ToString(CultureInfo.InvariantCulture));
            Assert.That(userAuthProviders.Count, Is.EqualTo(1));
        }
开发者ID:nstjelja,项目名称:ServiceStack,代码行数:17,代码来源:OAuthUserSessionTests.cs

示例13: GetRegistrationService

        public static RegistrationService GetRegistrationService(
            AbstractValidator<Registration> validator = null,
            IUserAuthRepository authRepo=null)
        {
            var requestContext = new MockRequestContext();
            var userAuthRepository = authRepo ?? GetStubRepo();
            var service = new RegistrationService {
                RegistrationValidator = validator ?? new RegistrationValidator { UserAuthRepo = userAuthRepository },
                UserAuthRepo = userAuthRepository,
                RequestContext = requestContext,
            };

            var appHost = GetAppHost();
            appHost.Register(userAuthRepository);
            service.SetAppHost(appHost);

            return service;
        }
开发者ID:robertgreen,项目名称:ServiceStack,代码行数:18,代码来源:RegistrationServiceTests.cs

示例14: HasAllRoles

        public bool HasAllRoles(IHttpRequest req, IAuthSession session, IUserAuthRepository userAuthRepo=null)
        {
            if (HasAllRoles(session)) return true;

            if (userAuthRepo == null)
                userAuthRepo = req.TryResolve<IUserAuthRepository>();

            if (userAuthRepo == null) return false;

            var userAuth = userAuthRepo.GetUserAuth(session, null);
            session.UpdateSession(userAuth);

            if (HasAllRoles(session))
            {
                req.SaveSession(session);
                return true;
            }
            return false;
        }
开发者ID:niemyjski,项目名称:ServiceStack,代码行数:19,代码来源:RequiredRoleAttribute.cs

示例15: CreateUser

        private void CreateUser(IUserAuthRepository userRep, int id, string userName, string email, string password, List<string> roles = null, List<string> permissions = null)
        {
            string hash;
            string salt;
            new SaltedHash().GetHashAndSaltString(password, out hash, out salt);

            userRep.CreateUserAuth(new UserAuth {
            Id = id,
            DisplayName = "DisplayName",
            Email = email,
            UserName = userName,
            FirstName = "FirstName",
            LastName = "LastName",
            PasswordHash = hash,
            Salt = salt,
            Roles = roles,
            Permissions = permissions
            }, password);
        }
开发者ID:TIHan,项目名称:MonoWeb,代码行数:19,代码来源:App.cs


注:本文中的IUserAuthRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。