public CashGameService(CardsAppContext context, IHttpContextAccessor httpContext, UserManager <AppUser> userManager) { _context = context; _httpContext = httpContext; _userManager = userManager; _matchService = new MatchService(_context, _httpContext, _userManager); _cashGameGameId = _context.Games.First(x => x.Name.Contains("Cash Poker")).GameId; }
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { if (context == null) { Log.Logger.Error("Context was null on request"); return; } _context = context.HttpContext .RequestServices .GetService(typeof(CardsAppContext)) as CardsAppContext; if (_context == null) { Log.Logger.Error("Database Context was null on request, rejecting"); context.Result = new ContentResult { StatusCode = 500, Content = "Error with auth" }; return; } if (!context.HttpContext.Request.Headers.TryGetValue(APIKEYNAME, out var extractedApiKey)) { context.Result = new ContentResult() { StatusCode = 401, Content = "Api Key was not provided" }; return; } var result = _context.AppleAuthUsers.Where(x => x.DateArchived == null) .FirstOrDefault(x => x.ApiKey == extractedApiKey); if (result == null) { context.Result = new ContentResult() { StatusCode = 401, Content = "Api Key is not valid" }; return; } if (!result.IsAllowedAccess) { context.Result = new ContentResult() { StatusCode = 402, Content = "Awaiting ApiKey Activation" }; return; } await next(); }
public AuthController(ILogger <AuthController> logger, CardsAppContext context) { _logger = logger; _context = context; }
public ApiKeyAdminAttribute(CardsAppContext context) { _context = context; }
public IdentityService(CardsAppContext cardsContext, IdentityContext identityContext) { _cardsContext = cardsContext; _identityContext = identityContext; }
public MatchService(CardsAppContext context, IHttpContextAccessor httpContext, UserManager <AppUser> userManager) { _context = context; _httpContext = httpContext; _userManager = userManager; }
public FeesController(CardsAppContext context) { _context = context; }
public PlayerService(CardsAppContext context, IAnalytics analytic) { _context = context; _analytic = analytic; }
public GameService(CardsAppContext context) { _context = context; }
public BoardService(CardsAppContext context, IAnalytics analytic) { _context = context; _analytic = analytic; _playerService = new PlayerService(_context, _analytic); }