Example #1
0
        public static void Main(string[] args)
        {
            var services = new ServiceCollection();

            ConfigureServices(services);
            _serviceProvider = services.BuildServiceProvider();
            var request = Read();
            var type    = request.Type.ToUpperInvariant();
            var lst     = new List <IOperation>
            {
                new PingOperation(),
                new ChooseIdentityCertificateOperation(_configuration),
                new ChooseMedicalProfessionOperation(),
                new EhealthCertificateAuthenticateOperation(_serviceProvider),
                new EidAuthenticateOperation(_serviceProvider),
                new GetIdentityCertificatesOperation(_configuration),
                new GetMedicalProfessionsOperation(_configuration),
                new GetIdentityCertificateOperation(_configuration)
            };
            var operation = lst.FirstOrDefault(_ => _.Code.Equals(type, StringComparison.InvariantCultureIgnoreCase));

            if (operation == null)
            {
                var result = new BrowserExtensionResponseGeneric <ErrorResponse>(request.Nonce, "error", new ErrorResponse {
                    Message = "operation is unknown"
                });
                SendResponse(result);
                return;
            }
            {
                var result = operation.Handle(request);
                SendResponse(result);
            }
        }
Example #2
0
        protected BrowserExtensionResponse BuildError(BrowserExtensionRequest request, string message)
        {
            var result = new BrowserExtensionResponseGeneric <ErrorResponse>(request.Nonce, "error", new ErrorResponse {
                Message = message
            });

            return(result);
        }
Example #3
0
        protected BrowserExtensionResponse BuildResponse <T>(BrowserExtensionRequest request, T content)
        {
            var result = new BrowserExtensionResponseGeneric <T>(request.Nonce, Response, content);

            return(result);
        }