Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public RecordRepository(OpmContext context)
 {
     _context = context;
 }
Esempio n. 3
0
 public UserRepository(OpmContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public RoleRepository(OpmContext context)
 {
     _context = context;
 }
Esempio n. 5
0
 public PatientRepository(OpmContext context)
 {
     _context = context;
 }
Esempio n. 6
0
 public RefractionRepository(OpmContext context)
 {
     _context = context;
 }