async Task <ApiResourceMetaData> GetCoreMetaDataAsync()
        {
            if (_metadata == null)
            {
                _metadata = await _service.GetMetadataAsync();

                if (_metadata == null)
                {
                    throw new InvalidOperationException("IdentityResourceMetaData returned null");
                }
                _metadata.Validate();

                return(_metadata);
            }

            return(_metadata);
        }
Exemplo n.º 2
0
        private async Task <IdentityAdminMetadata> GetMetadataAsync()
        {
            if (_metadata == null)
            {
                var clientMetadata = await _clientService.GetMetadataAsync();

                var identityResourceMetaData = await _identityResourceService.GetMetadataAsync();

                var apiResourceMetaData = await _apiResourceService.GetMetadataAsync();

                if (clientMetadata == null)
                {
                    throw new InvalidOperationException("Client GetMetadataAsync returned null");
                }
                if (identityResourceMetaData == null)
                {
                    throw new InvalidOperationException("Identity Resource GetMetadataAsync returned null");
                }
                if (apiResourceMetaData == null)
                {
                    throw new InvalidOperationException("Api Resource GetMetadataAsync returned null");
                }

                _metadata = new IdentityAdminMetadata
                {
                    ClientMetaData           = clientMetadata,
                    IdentityResourceMetaData = identityResourceMetaData,
                    ApiResourceMetaData      = apiResourceMetaData
                };
                if (_metadata == null)
                {
                    throw new InvalidOperationException("GetMetadataAsync returned null");
                }
                _metadata.Validate();
            }

            return(_metadata);
        }