Exemple #1
0
        private Task AddResource(Entity.EntityResourceKind kind)
        {
            var entity = new Entity.ApiScopeLocalizedResource
            {
                ResourceKind = kind
            };

            Model.Resources.Add(entity);
            HandleModificationState.EntityCreated(entity);
            return(Task.CompletedTask);
        }
        protected override Task <Entity.RelyingParty> Create()
        {
            var claimMappingList = new List <Entity.RelyingPartyClaimMapping>
            {
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.Name,
                    ToClaimType   = ClaimTypes.Name
                },
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.Subject,
                    ToClaimType   = ClaimTypes.NameIdentifier
                },
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.Email,
                    ToClaimType   = ClaimTypes.Email
                },
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.GivenName,
                    ToClaimType   = ClaimTypes.GivenName
                },
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.FamilyName,
                    ToClaimType   = ClaimTypes.Surname
                },
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.BirthDate,
                    ToClaimType   = ClaimTypes.DateOfBirth
                },
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.WebSite,
                    ToClaimType   = ClaimTypes.Webpage
                },
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.Gender,
                    ToClaimType   = ClaimTypes.Gender
                },
                new Entity.RelyingPartyClaimMapping
                {
                    FromClaimType = JwtClaimTypes.Role,
                    ToClaimType   = ClaimTypes.Role
                }
            };

            foreach (var item in claimMappingList)
            {
                HandleModificationState.EntityCreated(item);
            }

            return(Task.FromResult(new Entity.RelyingParty
            {
                TokenType = TOKENTYPELIST.First(),
                DigestAlgorithm = DIGESTLIST.First(),
                SamlNameIdentifierFormat = NAMEIDENTIFIERFORMATLIST.First(),
                SignatureAlgorithm = SIGNATUREALGORITHMLIST.First(),
                ClaimMappings = claimMappingList
            }));
        }