public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { /*** Replace below user authentication code as per your Entity Framework Model *** */ using (var obj = new OpmContext()) { var entry = obj.Users.FirstOrDefault(record => record.Username == context.UserName && record.Password == context.Password); if (entry == null) { context.SetError("invalid_grant", "The user name or password is incorrect."); return; } } ClaimsIdentity oAuthIdentity = new ClaimsIdentity(context.Options.AuthenticationType); ClaimsIdentity cookiesIdentity = new ClaimsIdentity(context.Options.AuthenticationType); AuthenticationProperties properties = CreateProperties(context.UserName); AuthenticationTicket ticket = new AuthenticationTicket(oAuthIdentity, properties); context.Validated(ticket); context.Request.Context.Authentication.SignIn(cookiesIdentity); }
public RecordRepository(OpmContext context) { _context = context; }
public UserRepository(OpmContext context) { _context = context; }
public RoleRepository(OpmContext context) { _context = context; }
public PatientRepository(OpmContext context) { _context = context; }
public RefractionRepository(OpmContext context) { _context = context; }