private static void MapFromContext( TokenGeneratingContext context, IList <Claim> ambientClaims, TokenMapping claimsDefinition) { foreach (var mapping in claimsDefinition) { var ctxValues = ambientClaims.Where(c => c.Type == mapping.Alias); ValidateCardinality(mapping, ctxValues, claimsDefinition.Source); foreach (var ctxValue in ctxValues) { context.AddClaimToCurrentToken(mapping.Name, ctxValue.Value); } } }
private static void MapFromPrincipal( TokenGeneratingContext context, ClaimsPrincipal user, TokenMapping claimsDefinition) { foreach (var mapping in claimsDefinition) { var foundClaims = user.FindAll(mapping.Alias); ValidateCardinality(mapping, foundClaims, claimsDefinition.Source); foreach (var userClaim in foundClaims) { context.AddClaimToCurrentToken(mapping.Name, userClaim.Value); } } }
private static void AddContextClaims(TokenMapping tokenMapping) { tokenMapping.AddSingle(IdentityServiceExtensionsClaimTypes.TrustFrameworkPolicy, IdentityServiceExtensionsAmbientClaimTypes.Policy); tokenMapping.AddSingle(IdentityServiceExtensionsClaimTypes.Version, IdentityServiceExtensionsAmbientClaimTypes.Version); }