Beispiel #1
0
        public virtual int CreateIdentityResource(IdentityResourceEntity identityResourceEntity,
                                                  IEnumerable <int> claimsIds)
        {
            identityResourceEntity.ClaimTypes =
                new HashSet <ClaimTypeEntity>(m_claimTypeRepository.GetClaimTypesById(claimsIds));
            var result = (int)m_identityResourceRepository.Create(identityResourceEntity);

            return(result);
        }
        public virtual int CreateApiResource(ApiResourceEntity apiResourceEntity, IEnumerable <int> claimsIds, ScopeEntity defaultScope)
        {
            var claimTypes = m_claimTypeRepository.GetClaimTypesById(claimsIds);

            apiResourceEntity.ClaimTypes = new HashSet <ClaimTypeEntity>(claimTypes);

            var result = (int)m_apiResourceRepository.Create(apiResourceEntity);

            var apiResource = m_apiResourceRepository.Load <ApiResourceEntity>(result);

            defaultScope.ApiResource = apiResource;
            defaultScope.ClaimTypes  = new HashSet <ClaimTypeEntity>(claimTypes);

            var scopeResult = (int)m_scopeRepository.Create(defaultScope);

            return(result);
        }
Beispiel #3
0
        public virtual int AddScopeToApiResource(int apiResourceId, ScopeEntity newScope, IEnumerable <int> claimsIds)
        {
            var apiResource = m_apiResourceRepository.FindById <ApiResourceEntity>(apiResourceId);

            newScope.ApiResource = apiResource ?? throw new NoResultException <ApiResourceEntity>();

            newScope.ClaimTypes = new HashSet <ClaimTypeEntity>(m_claimTypeRepository.GetClaimTypesById(claimsIds));

            var result = (int)m_scopeRepository.Create(newScope);

            return(result);
        }