本文整理汇总了C#中SignInManager类的典型用法代码示例。如果您正苦于以下问题:C# SignInManager类的具体用法?C# SignInManager怎么用?C# SignInManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SignInManager类属于命名空间,在下文中一共展示了SignInManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MeApiController
public MeApiController(UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
IMediator mediator)
{
_userManager = userManager;
_signInManager = signInManager;
_mediator = mediator;
}
示例2: LoginController
public LoginController(
SignInManager signInManager,
SignInInteraction signInInteraction)
{
_signInManager = signInManager;
_signInInteraction = signInInteraction;
}
示例3: AccountController
public AccountController(
SignInManager<Identity> signInManager,
ILoggerFactory loggerFactory)
{
_signInManager = signInManager;
_logger = loggerFactory.CreateLogger<AccountController>();
}
示例4: WeekBasketManagementController
public WeekBasketManagementController(ApplicationDbContext context, IHostingEnvironment environment,
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
IServiceProvider serviceProvider) : base(serviceProvider, userManager, context, environment, signInManager)
{
}
示例5: UserService
public UserService(UserManager<User, int> userManager, SignInManager<User, int> signinManager
, IAuthenticationManager authManager)
{
_userManager = userManager;
_signinManager = signinManager;
_authManager = authManager;
}
示例6: AccountController
public AccountController(
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager)
{
UserManager = userManager;
SignInManager = signInManager;
}
示例7: AccountController
public AccountController(IConfigurationRoot appSettings, UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, ILoggerFactory loggerFactory)
{
_appSettings = appSettings;
_userManager = userManager;
_signInManager = signInManager;
_logger = loggerFactory.CreateLogger<AccountController>();
}
示例8: MockAccountController
private static AccountController MockAccountController(SignInManager<ApplicationUser> mockSignInManager, UserManager<ApplicationUser> mockUserManager)
{
var mockEmailSender = new Mock<IEmailSender>();
var mockSmsSender = new Mock<ISmsSender>();
var mockApplicationDbContext = new Mock<ApplicationDbContext>();
var mockEmailTemplate = new Mock<IEmailTemplate>();
var mockNullLoggerFactory = new NullLoggerFactory();
var mockLocalizer = new Mock<IStringLocalizer<AccountController>>();
mockLocalizer.Setup(m => m[It.IsAny<string>()])
.Returns<string>(x => new LocalizedString(x, x, false));
mockLocalizer.Setup(m => m[It.IsAny<string>(), It.IsAny<object>()])
.Returns<string, object[]>((x, y) => new LocalizedString(x, string.Format(x, y), false));
var controller = new AccountController(mockUserManager, mockSignInManager, mockEmailSender.Object, mockSmsSender.Object, mockNullLoggerFactory, mockApplicationDbContext.Object, mockEmailTemplate.Object, mockLocalizer.Object);
var mockUrl = new Mock<IUrlHelper>();
mockUrl.Setup(m => m.IsLocalUrl("localUrl")).Returns(true);
mockUrl.Setup(m => m.IsLocalUrl("remoteUrl")).Returns(false);
controller.Url = mockUrl.Object;
return controller;
}
示例9: AccountController
public AccountController(UserManager<ApplicationUser> userMgr, SignInManager<ApplicationUser> signInMgr, ILogger<AccountController> log)
{
userManager = userMgr;
signInManager = signInMgr;
logger = log;
}
示例10: AccountController
public AccountController(
UserManager<User> userManager,
SignInManager<User> signInManager)
{
_signInManager = signInManager;
_userManager = userManager;
}
示例11: UsersController
public UsersController(ApplicationDbContext context, IHostingEnvironment environment,
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
IServiceProvider serviceProvider)
: base(context,environment,userManager,signInManager,serviceProvider)
{
}
示例12: AppController
public AppController(IHttpContextAccessor httpContextAccessor,
UserManager<MyUser> userManager,
IOptions<IdentityOptions> optionsAccessor)
{
SignInManager = new MySignInManager(userManager as MyUserManager, httpContextAccessor, new MyClaimsPrincipleFactory());
UserManager = userManager;
}
示例13: UserController
public UserController(SignInManager<ChirpUser> a_signInManager, UserManager<ChirpUser> a_userManager, ILogger<UserController> a_logger, IEmailSender a_emailSender)
{
m_signInManager = a_signInManager;
m_userManager = a_userManager;
m_logger = a_logger;
m_emailSender = a_emailSender;
}
示例14: UserManagerService
public UserManagerService(UserManager<AppIdentityUser> userMenager, IAuthenticationManager authenticationManager, RoleManager<IdentityRole> roleManager)
{
this._userMenager = userMenager;
this._authenticationManager = authenticationManager;
this._roleManager = roleManager;
//Pasword validation rules
_userMenager.UserValidator = new UserValidator<AppIdentityUser>(userMenager) { RequireUniqueEmail = true, AllowOnlyAlphanumericUserNames = false };
_userMenager.PasswordValidator = new PasswordValidator() { RequiredLength = 6, RequireLowercase = true, RequireUppercase = true, RequireDigit = true };
_signInMenager = new SignInManager<AppIdentityUser, string>(_userMenager, _authenticationManager);
//_userMenager.UserLockoutEnabledByDefault = true;
//_userMenager.DefaultAccountLockoutTimeSpan = TimeSpan.FromDays(int.MaxValue);
//_userMenager.SetLockoutEnabled(user.Id, enabled) // Enables or disables lockout for a user
//Register e-mail service for identity
_userMenager.EmailService = new EmailService();
//Token provider for password reset
var dataProtectionProvider = Startup.dataProtectionProvider;
if (dataProtectionProvider != null)
{
IDataProtector dataProtector = dataProtectionProvider.Create("ASP.NET Identity");
userMenager.UserTokenProvider = new DataProtectorTokenProvider<AppIdentityUser>(dataProtector);
}
}
示例15: IdentityServices
public IdentityServices(DbContext context, IAuthenticationManager authenticationMana, UserStore<IdentityUser> userStor, UserManager<IdentityUser> userMena)
{
db = context;
userStore = userStor;
userMenager = userMena;
authenticationManager = authenticationMana;
userMenager.UserValidator = new UserValidator<IdentityUser>(userMenager) { RequireUniqueEmail = true, AllowOnlyAlphanumericUserNames = false };
userMenager.PasswordValidator = new PasswordValidator() { RequiredLength = 6, RequireLowercase = true, RequireUppercase = true, RequireDigit = true };
signInMenager = new SignInManager<IdentityUser, string>(userMenager, authenticationManager);
userMenager.RegisterTwoFactorProvider("EmailCode", new EmailTokenProvider<IdentityUser>
{
Subject = "Security Code",
BodyFormat = "Your security code is {0}"
});
userMenager.EmailService = new EmailService();
var dataProtectionProvider = Startup.dataProtectionProvider;
if (dataProtectionProvider != null)
{
IDataProtector dataProtector = dataProtectionProvider.Create("ASP.NET Identity");
userMenager.UserTokenProvider = new DataProtectorTokenProvider<IdentityUser>(dataProtector);
}
}