public HttpResponseMessage Put(Password NewPas) { HttpResponseMessage response = null; Employee emp = new Employee(); emp = OrganisationDA.CheckCredentialsME(NewPas.Login, NewPas.OldPassword); if (emp != null) { EmployeeDA.ChangePassword(NewPas); response = Request.CreateResponse(HttpStatusCode.OK); } else { response = new HttpResponseMessage(HttpStatusCode.NotFound); } return(response); }
public override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { Employee o = OrganisationDA.CheckCredentialsME(context.UserName, context.Password); if (o == null) { context.Rejected(); return(Task.FromResult(0)); } var id = new ClaimsIdentity(context.Options.AuthenticationType); id.AddClaim(new Claim("dblogin", "Scouts")); id.AddClaim(new Claim("organisatie", "Scouts")); id.AddClaim(new Claim("dbpassword", "Scouts")); id.AddClaim(new Claim("dbname", "Scouts")); context.Validated(id); return(Task.FromResult(0)); }