public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { // Allow CORS on the token middleware provider context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" }); //TODO // Usually this would be done via dependency injection // But I haven't got it to work with the OWIN startup class yet AppDBContext _ctx = new AppDBContext(); UserRepository _repo = new UserRepository(_ctx); IdentityUser user = await _repo.FindUser(context.UserName, context.Password); if (user == null) { context.SetError("invalid_grant", "The user name or password is incorrect."); return; } var identity = new ClaimsIdentity(context.Options.AuthenticationType); identity.AddClaim(new Claim("sub", context.UserName)); identity.AddClaim(new Claim("role", "user")); context.Validated(identity); }
protected void Page_Load(object sender, EventArgs e) { db = new AppDBContext(); var externalAuthClients = db.ExternalAuthClients.ToList(); if(externalAuthClients == null || externalAuthClients.Count == 0) { StatusText.Text = "Does not exist any record yet"; StatusPane.Visible = true; } else { grdVAuthLogins.DataSource = externalAuthClients; grdVAuthLogins.DataBind(); } db.Dispose(); }
protected void btnCreate_Click(object sender, EventArgs e) { db = new AppDBContext(); var url = txtUrl.Text; Guid g = Guid.NewGuid(); string urlId = g.ToString(); urlId = urlId.Replace("-", ""); var authUrlitem = new ExternalAuthClients { Id = urlId, Url = url, Name = txtName.Text }; db.ExternalAuthClients.Add(authUrlitem); db.SaveChanges(); Response.Redirect(Request.RawUrl); db.Dispose(); }
public UserTestController(AppDBContext context) { this.context = context; }
public RequestQuotationRepository(AppDBContext context) : base(context) { }
public ContactService(AppDBContext context) { _datacontext = context; }
//private List<Car> _cars; public CarService(AppDBContext context) { this.context = context; }
public IndexModel(AppDBContext db) { _context = db; }
public Repository(AppDBContext context) { this._context = context; }
public MItemGroupsController(AppDBContext context) { _context = context; }
public MconditionsController(AppDBContext context) { _context = context; }
public HomeController(ILogger <HomeController> logger, UserManager <IdentityUser> userManager, SignInManager <IdentityUser> signInManager, AppDBContext context, RoleManager <IdentityRole> roleManager) { _logger = logger; _userManager = userManager; _signInManager = signInManager; _context = context; _roleManager = roleManager; }
public ProductService(AppDBContext dbContext, IMapper mapper, ILogger <ProductService> log) { _dbContext = dbContext; _mapper = mapper; _log = log; }
public ReferencesRepository(AppDBContext context) { _context = context; }
public empleadoController(AppDBContext context) { _context = context; }
public CategoryService(AppDBContext stockTrackingEntities) : base(stockTrackingEntities) { }
public TrainingsController(AppDBContext context, ITrainingRepository trainingRepository) { _context = context; this.trainingRepository = trainingRepository; }
public EFContractorRepository(AppDBContext context) { this.context = context; }
public MembersController(AppDBContext context, UserManager <IdentityUser> userManager) { _context = context; _userManager = userManager; }
public GetUrlController(ILogger <GetUrlController> logger, AppDBContext appDbContext, IConfiguration configuration) { _logger = logger; _AppDbContext = appDbContext; Configuration = configuration; }
public ViajanteRepository(AppDBContext appDBContext) { _appDBContext = appDBContext; }
public ItemTypeController(AppDBContext context) { _context = context; }
public VideoRepository(AppDBContext appDbContext) { this._appDbContext = appDbContext; }
public ProductsRepository(AppDBContext appDBContext) : base(appDBContext) { }
public DepartmentController(AppDBContext dBContext, IRepository repository) { _repository = repository; }
public PropertyRepository(AppDBContext context) : base(context) { }
public ServiceBase(AppDBContext dbContext, IMapper mapper, IHttpContextAccessor httpContext) { _dbContext = dbContext; _mapper = mapper; _httpContext = httpContext; }
public CategoryRepository(AppDBContext context) : base(context) { }
public WholesalerRepository(AppDBContext ctx) { _ctx = ctx; }
public RatingRepository(AppDBContext context) : base(context, ProgressPrice.Basic) { _context = context; }
public void Dispose() { if (_db != null) { _db.Dispose(); _db = null; } if (_usrDb != null) { _usrDb.Dispose(); _usrDb = null; } }
public AccountController(AppDBContext context) { db = context; }
public GCalendarioModel(IRepositoryCalendario repositoryCalendario, IRepositoryRegistroEscuela repositorioEscuela, AppDBContext context) { this.repositoryCalendario = repositoryCalendario; this.repositorioEscuela = repositorioEscuela; _context = context; }
public CartRepository(AppDBContext ctx) { _ctx = ctx; }
public UsersController(AppDBContext context) { _context = context; }
public EditModel(AppDBContext db) { _db = db; }
public ProductRepository(AppDBContext ctx) { _ctx = ctx; }