本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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);
}
示例5: UserAuthController
public UserAuthController(IUserAuthRepository authRepo
,IStoreRepository storeRepo
,IBrandRepository brandRepo
,ICustomerRepository customerRepo)
{
_authRepo = authRepo;
_storeRepo = storeRepo;
_brandRep = brandRepo;
_customerRepo = customerRepo;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}