public ProfileDataRequest( ClaimsPrincipal subject, Client client, string caller, IEnumerable<string> requestedClaimTypes ) { if (subject == null) { throw new ArgumentNullException(nameof(subject)); } if (client == null) { throw new ArgumentNullException(nameof(client)); } if (string.IsNullOrEmpty(caller)) { throw new ArgumentNullException(nameof(caller)); } if (requestedClaimTypes == null) { throw new ArgumentNullException(nameof(caller)); } this.Subject = subject; this.Client = client; this.Caller = caller; this.RequestedClaimTypes = requestedClaimTypes; }
public ProfileDataRequest( ClaimsPrincipal subject, Client client, string caller ) : this(subject, client, caller, Enumerable.Empty<string>()) { this.AllClaimsRequested = true; }
public async Task<bool> IsActiveAsync(ClaimsPrincipal subject, Client client) { var account = await directoryContext.FindUserByNameAsync(subject.Identity.Name); return account != null; }
/// <summary> /// Check if a specific user exists /// </summary> /// <param name="subject"></param> /// <param name="client"></param> /// <returns></returns> public async Task<bool> IsActiveAsync(ClaimsPrincipal subject, Client client) { if (subject == null) { throw new ArgumentNullException("subject"); } //Not sure about this var subjectId = subject.Claims.FirstOrDefault(c => c.Type == "sub").Value; var activeUser = await manager.FindByIdAsync(subjectId); bool IsActive = false; if (activeUser != null) { if (EnableSecurityStamp && manager.SupportsUserSecurityStamp) { var security_stamp = subject.Claims.Where(x => x.Type == "security_stamp").Select(x => x.Value).SingleOrDefault(); if (security_stamp != null) { var db_security_stamp = await manager.GetSecurityStampAsync(activeUser.Id); if (db_security_stamp != security_stamp) { return false; //what do I do here, true or false or error? } } } IsActive = true; } return IsActive; }