public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" }); using (SavingsDBContext _repo = new SavingsDBContext()) { UserModel user = _repo.UserModels.Where(a => a.userName.Equals(context.UserName, StringComparison.CurrentCulture) && a.password.Equals(context.Password)).FirstOrDefault(); 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")); await Task.Delay(1); context.Validated(identity); }
public SavingsTypesController(SavingsDBContext dbcontext) { db = dbcontext; }
public SavingsDetailsController(SavingsDBContext dbcontext) { db = dbcontext; }