public BedrockResourceAuthorizationManager ( IClaimType claimType, IClaimCollectorFactory claimCollectorFactory, BedrockConfiguration bedrockConfiguration ) : base ( claimType, claimCollectorFactory, bedrockConfiguration ) { }
public static ClaimsPrincipal Transform(this ClaimsPrincipal principal, IClaimType claimType) { var scopeClaims = principal.FindAll(claimType.ScopeClaimType).ToList(); if (scopeClaims.Count != 1 || !scopeClaims[0].Value.Contains(' ')) { return(principal); } var claim = scopeClaims[0]; var scopes = claim.Value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var claims = scopes.Select(s => new Claim(claimType.ScopeClaimType, s)); return(new ClaimsPrincipal(new ClaimsIdentity(principal.Identity, claims))); }
public PostAuthenticationMiddlewareOptions(IClaimType claimType) { ClaimType = claimType; }
public AzureAdScopeClaimTransformation(IClaimType claimType) => this.claimType = claimType;
public BedrockBearerEvents(IClaimType claimType) { ClaimType = claimType; }
public static IBedrockUser CreateFromPrincipal(ClaimsPrincipal claimsPrincipal, IClaimType claimType) { var globalKey = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.Subject)?.Value; return(new BedrockUser { DisplayName = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.DisplayName)?.Value, GivenName = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.GivenName)?.Value, Surname = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.Surname)?.Value, JobTitle = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.JobTitle)?.Value, Emails = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.Emails)?.Value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), StreetAddress = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.StreetAddress)?.Value, City = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.City)?.Value, State = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.State)?.Value, PostalCode = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.PostalCode)?.Value, Country = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == claimType.Country)?.Value, UserType = UserType.User, GlobalKey = !string.IsNullOrWhiteSpace(globalKey) ? new Guid(globalKey) : Guid.Empty }); }
public ResourceAuthorizationManagerBase(IClaimType claimType, IClaimCollectorFactory claimCollectorFactory, BedrockConfiguration bedrockConfiguration) { ClaimType = claimType; ClaimCollectorFactory = claimCollectorFactory; BedrockConfiguration = bedrockConfiguration; }
public static IApplicationBuilder UsePostAuthenticateMiddleware(this IApplicationBuilder application, IClaimType claimType) { var options = new PostAuthenticationMiddlewareOptions(claimType); return(application.UsePostAuthenticateMiddleware(options)); }