public override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { ItOrganisation o = OrganisationDA.GetOrganisationByLoginAndPassword(context.UserName, context.Password); if (o == null) { context.Rejected(); return(Task.FromResult(0)); } var id = new ClaimsIdentity(context.Options.AuthenticationType); id.AddClaim(new Claim("dbname", o.DbName)); id.AddClaim(new Claim("dblogin", o.DbLogin)); id.AddClaim(new Claim("dbpass", o.DBpass)); context.Validated(id); return(Task.FromResult(0)); }