コード例 #1
0
        public static ApplicationUserManager Create(
            IdentityFactoryOptions <ApplicationUserManager> options,
            IOwinContext context)
        {
            IGwintContext gwintContext = context.GetAutofacLifetimeScope().Resolve <IGwintContext>();
            var           manager      = new ApplicationUserManager(new UserStore(gwintContext));

            manager.UserValidator = new UserValidator <ApplicationUser>(manager)
            {
                AllowOnlyAlphanumericUserNames = false,
                //RequireUniqueEmail = true
            };
            // Konfigurieren der Überprüfungslogik für Kennwörter.
            manager.PasswordValidator = new PasswordValidator
            {
                //RequiredLength = 6
            };
            var dataProtectionProvider = options.DataProtectionProvider;

            if (dataProtectionProvider != null)
            {
                manager.UserTokenProvider = new DataProtectorTokenProvider <ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"));
            }
            return(manager);
        }
コード例 #2
0
ファイル: GameHub.cs プロジェクト: yayanyang/Gwent.NET
        private Deck GenerateDemoDeck(IGwintContext context)
        {
            var battleKingCard = context.Cards.Find(3002L);
            var cards          = new List <Card>()
            {
                context.Cards.Find(0L),
                context.Cards.Find(0L),
                context.Cards.Find(1L),
                context.Cards.Find(2L),
                context.Cards.Find(3L),
                context.Cards.Find(4L),
                context.Cards.Find(5L),
                context.Cards.Find(6L),
                context.Cards.Find(7L),
                context.Cards.Find(8L),
                context.Cards.Find(9L),
                context.Cards.Find(10L),
                context.Cards.Find(11L),
                context.Cards.Find(12L),
                context.Cards.Find(306L),
                context.Cards.Find(306L),
                context.Cards.Find(306L),
                context.Cards.Find(306L),
                context.Cards.Find(306L),
                context.Cards.Find(306L),
                context.Cards.Find(306L),
                context.Cards.Find(306L),
                context.Cards.Find(306L)
            };

            var demoDeck = new Deck
            {
                Faction        = GwintFaction.Scoiatael,
                BattleKingCard = battleKingCard.ToDeckCard(),
                Cards          = cards.Select(c => c.ToDeckCard()).ToList(),
                IsPrimaryDeck  = true
            };

            return(demoDeck);
        }
コード例 #3
0
 protected AuthenticatedApiController(IGwintContext context)
 {
     Context = context;
 }
コード例 #4
0
 public DeckController(IGwintContext context)
     : base(context)
 {
 }
コード例 #5
0
ファイル: GameHub.cs プロジェクト: yayanyang/Gwent.NET
 private Game GetActiveGameByUserId(IGwintContext context, long userId)
 {
     return(context.Games.FirstOrDefault(g => g.IsActive && g.Players.Any(p => p.User.Id == userId)));
 }
コード例 #6
0
ファイル: CardController.cs プロジェクト: yayanyang/Gwent.NET
 public CardController(IGwintContext context)
 {
     _context = context;
 }
コード例 #7
0
 public UserController(IGwintContext context)
     : base(context)
 {
 }
コード例 #8
0
ファイル: UserStore.cs プロジェクト: yayanyang/Gwent.NET
 public UserStore(IGwintContext context)
 {
     _context = context;
 }