public override Task GetProfileDataAsync(ProfileDataRequestContext context) { var user = InMemoryUsers.GetAllUsers().SingleOrDefault(x => x.Subject == context.Subject.GetSubjectId()); if (user != null) { context.IssuedClaims = user.Claims.Where(x => context.RequestedClaimTypes.Contains(x.Type)); } return(Task.FromResult(0)); }
public override Task AuthenticateLocalAsync(LocalAuthenticationContext context) { var user = InMemoryUsers.GetAllUsers().SingleOrDefault(x => x.Username == context.UserName && x.Password == context.Password); if (user != null) { context.AuthenticateResult = new AuthenticateResult(user.Subject, user.Username); } return(Task.FromResult(0)); }