示例#1
0
        public override async Task <CapabilityStatement> GetCapabilityStatementAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            if (_capabilityStatement == null)
            {
                await _sem.WaitAsync(cancellationToken);

                try
                {
                    if (_capabilityStatement == null)
                    {
                        var generated =
                            await _systemConformance.GetSystemListedCapabilitiesStatementAsync(cancellationToken);

                        var configured =
                            await _configuredConformanceProvider.GetCapabilityStatementAsync(cancellationToken);

                        _capabilityStatement =
                            generated.Intersect(configured, _conformanceConfiguration.UseStrictConformance);

                        _capabilityStatement.UrlElement = new FhirUri(_urlResolver.ResolveMetadataUrl(false));
                    }
                }
                finally
                {
                    _sem.Release();
                }
            }

            return(_capabilityStatement);
        }
示例#2
0
 public void Build(ListedCapabilityStatement statement)
 {
     if (_securityConfiguration.Enabled)
     {
         if (_securityConfiguration.EnableAadSmartOnFhirProxy)
         {
             statement.AddProxyOAuthSecurityService(_urlResolver.ResolveMetadataUrl(false));
         }
         else
         {
             statement.AddOAuthSecurityService(_securityConfiguration.Authentication.Authority, _httpClientFactory, _logger);
         }
     }
 }
示例#3
0
        public async Task <GetSystemCapabilitiesResponse> Handle(GetSystemCapabilitiesRequest message, CancellationToken cancellationToken)
        {
            EnsureArg.IsNotNull(message, nameof(message));

            var systemListedCapabilities = await _systemConformanceProvider.GetSystemListedCapabilitiesStatementAsync(cancellationToken);

            using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"{GetType().Namespace}.AllCapabilities.json"))
                using (var reader = new StreamReader(resourceStream))
                {
                    var allCapabilities = _parser.Parse <CapabilityStatement>(await reader.ReadToEndAsync());

                    var mergedSystemCapabilities = systemListedCapabilities.Intersect(allCapabilities, strictConfig: false);
                    mergedSystemCapabilities.UrlElement = new FhirUri(_urlResolver.ResolveMetadataUrl(true));

                    return(new GetSystemCapabilitiesResponse(mergedSystemCapabilities.ToResourceElement()));
                }
        }