Beispiel #1
0
 public RadioButton(Bind bind, SecurityDefinition security, string text, Updates updates, AttributeCollection attributes) :
     base(ControlTypes.RadioButton, bind, security)
 {
     this.Text       = text;
     this.Updates    = updates;
     this.Attributes = attributes;
 }
Beispiel #2
0
 public ImageButton(Bind bind, SecurityDefinition security, string source, Updates updates, AttributeCollection attributes) :
     base(ControlTypes.ImageButton, bind, security)
 {
     this.Source     = source;
     this.Updates    = updates;
     this.Attributes = attributes;
 }
Beispiel #3
0
 public Textbox(Bind bind, SecurityDefinition security, string text, string defaultButtonId, Updates updates, AttributeCollection attributes) :
     base(ControlTypes.Textbox, bind, security)
 {
     this.Text            = text;
     this.DefaultButtonId = defaultButtonId;
     this.Updates         = updates;
     this.Attributes      = attributes;
 }
        public void ParsesCSV(string line, string cusipExpected, string figiExpected, string sedolExpected, string isinExpected)
        {
            var securityDefinition = SecurityDefinition.FromCsvLine(line);

            Assert.AreEqual(cusipExpected, securityDefinition.CUSIP);
            Assert.AreEqual(figiExpected, securityDefinition.CompositeFIGI);
            Assert.AreEqual(sedolExpected, securityDefinition.SEDOL);
            Assert.AreEqual(isinExpected, securityDefinition.ISIN);
        }
 public void DoesNotParseCSV(string line)
 {
     try
     {
         var lines = SecurityDefinition.FromCsvLine(line);
         Assert.Fail($"Successfully read line when expecting failure: {line}");
     }
     catch
     {
     }
 }
Beispiel #6
0
        public override IBase Clone()
        {
            Bind bind = null;

            Bind?.Clone(out bind);

            SecurityDefinition security = null;

            Security?.Clone(out security);

            return(new Textarea(bind, security, this.Content, this.Attributes.Clone()));
        }
        public override IBase Clone()
        {
            Bind bind = null;

            Bind?.Clone(out bind);

            SecurityDefinition security = null;

            Security?.Clone(out security);

            return(new ConditionalStatement(bind, security));
        }
Beispiel #8
0
        public override IBase Clone()
        {
            Bind bind = null;

            Bind?.Clone(out bind);

            SecurityDefinition security = null;

            Security?.Clone(out security);

            return(new DataList(bind, security));
        }
Beispiel #9
0
        public override IBase Clone()
        {
            Bind bind = null;

            Bind?.Clone(out bind);

            SecurityDefinition security = null;

            Security?.Clone(out security);

            return(new RadioButton(bind, security, this.Text, this.Updates.Clone(), this.Attributes.Clone()));
        }
Beispiel #10
0
        public override IBase Clone()
        {
            Bind bind = null;

            Bind?.Clone(out bind);

            SecurityDefinition security = null;

            Security?.Clone(out security);

            return(new VariableBlock(bind, security));
        }
Beispiel #11
0
        public void Clone(out SecurityDefinition security)
        {
            security = new SecurityDefinition();

            security._Set            = this._Set;
            security.RegisteredGroup = this.RegisteredGroup;
            security._FriendlyName   = this._FriendlyName;

            if (this.Bind != null)
            {
                Basics.Execution.Bind bind;
                this.Bind.Clone(out bind);
                security.Bind = bind;
            }

            security.Disabled = this.Disabled;
        }
Beispiel #12
0
 public DataList(Bind bind, SecurityDefinition security) :
     base(ControlTypes.DataList, bind, security)
 {
 }
Beispiel #13
0
 public void OnMessage(SecurityDefinition secDef, SessionID sessionID)
 {
     // Add handling if needed
 }
Beispiel #14
0
 public virtual void onMessage(SecurityDefinition message, QuickFix.SessionID session)
 {
     throw new QuickFix.UnsupportedMessageType();
 }
Beispiel #15
0
        public IBase Select(string controlId)
        {
            if (string.IsNullOrEmpty(controlId))
            {
                return(new Unknown());
            }

            XPathNavigator xPathControlNav =
                this._XPathNavigator.SelectSingleNode($"/Controls/Control[@id='{controlId}']");

            if (xPathControlNav == null)
            {
                return(new Unknown());
            }

            ControlTypes type =
                ControlManager.ReadType(xPathControlNav.Clone());

            if (type == ControlTypes.Unknown)
            {
                return(new Unknown());
            }

            Bind bind = ControlManager.ReadBind(xPathControlNav.Clone());
            SecurityDefinition security =
                ControlManager.ReadSecurityDefinition(xPathControlNav.Clone());

            switch (type)
            {
            case ControlTypes.ConditionalStatement:
                return(new ConditionalStatement(bind, security));

            case ControlTypes.DataList:
                return(new DataList(bind, security));

            case ControlTypes.VariableBlock:
                return(new VariableBlock(bind, security));

            case ControlTypes.Button:
                return(new Button(bind, security,
                                  ControlManager.ReadValue(xPathControlNav.Clone(), "text"),
                                  ControlManager.ReadUpdates(xPathControlNav.Clone()),
                                  ControlManager.ReadAttributes(xPathControlNav.Clone())));

            case ControlTypes.Checkbox:
                return(new Checkbox(bind, security,
                                    ControlManager.ReadValue(xPathControlNav.Clone(), "text"),
                                    ControlManager.ReadUpdates(xPathControlNav.Clone()),
                                    ControlManager.ReadAttributes(xPathControlNav.Clone())));

            case ControlTypes.RadioButton:
                return(new RadioButton(bind, security,
                                       ControlManager.ReadValue(xPathControlNav.Clone(), "text"),
                                       ControlManager.ReadUpdates(xPathControlNav.Clone()),
                                       ControlManager.ReadAttributes(xPathControlNav.Clone())));

            case ControlTypes.ImageButton:
                return(new ImageButton(bind, security,
                                       ControlManager.ReadValue(xPathControlNav.Clone(), "source"),
                                       ControlManager.ReadUpdates(xPathControlNav.Clone()),
                                       ControlManager.ReadAttributes(xPathControlNav.Clone())));

            case ControlTypes.LinkButton:
                return(new LinkButton(bind, security,
                                      ControlManager.ReadValue(xPathControlNav.Clone(), "text"),
                                      ControlManager.ReadValue(xPathControlNav.Clone(), "url"),
                                      ControlManager.ReadUpdates(xPathControlNav.Clone()),
                                      ControlManager.ReadAttributes(xPathControlNav.Clone())));

            case ControlTypes.Textbox:
                return(new Textbox(bind, security,
                                   ControlManager.ReadValue(xPathControlNav.Clone(), "text"),
                                   ControlManager.ReadValue(xPathControlNav.Clone(), "defaultbuttonid"),
                                   ControlManager.ReadUpdates(xPathControlNav.Clone()),
                                   ControlManager.ReadAttributes(xPathControlNav.Clone())));

            case ControlTypes.Password:
                return(new Password(bind, security,
                                    ControlManager.ReadValue(xPathControlNav.Clone(), "text"),
                                    ControlManager.ReadValue(xPathControlNav.Clone(), "defaultbuttonid"),
                                    ControlManager.ReadUpdates(xPathControlNav.Clone()),
                                    ControlManager.ReadAttributes(xPathControlNav.Clone())));

            case ControlTypes.Textarea:
                return(new Textarea(bind, security,
                                    ControlManager.ReadValue(xPathControlNav.Clone(), "content"),
                                    ControlManager.ReadAttributes(xPathControlNav.Clone())));
            }

            return(new Unknown());
        }
Beispiel #16
0
 public void OnMessage(SecurityDefinition secDef, SessionID sessionID)
 {
     // Add handling if needed
 }
Beispiel #17
0
 public Textarea(Bind bind, SecurityDefinition security, string content, AttributeCollection attributes) :
     base(ControlTypes.Textarea, bind, security)
 {
     this.Content    = content;
     this.Attributes = attributes;
 }
 public ConditionalStatement(Bind bind, SecurityDefinition security) :
     base(ControlTypes.ConditionalStatement, bind, security)
 {
 }
Beispiel #19
0
        private static SecurityDefinition ReadSecurityDefinition(XPathNavigator xPathControlNav)
        {
            SecurityDefinition security =
                new SecurityDefinition();

            XPathNavigator target =
                xPathControlNav.SelectSingleNode("*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'security']");

            if (target == null || !target.MoveToFirstChild())
            {
                return(security);
            }

            XPathNavigator readerSecurity = xPathControlNav.Clone();

            if (!readerSecurity.MoveToFirstChild())
            {
                return(security);
            }

            security = new SecurityDefinition();

            do
            {
                switch (readerSecurity.Name.ToLower(CultureInfo.InvariantCulture))
                {
                case "registeredgroup":
                    security.RegisteredGroup = readerSecurity.Value;

                    break;

                case "friendlyname":
                    security.FriendlyName = readerSecurity.Value;

                    break;

                case "bind":
                    security.Bind = Bind.Make(readerSecurity.Value);

                    break;

                case "disabled":
                    security.Disabled.Set = true;

                    if (!Enum.TryParse(
                            readerSecurity.GetAttribute("type", readerSecurity.NamespaceURI),
                            out SecurityDefinition.DisabledDefinition.Types secType)
                        )
                    {
                        secType = SecurityDefinition.DisabledDefinition.Types.Inherited;
                    }

                    security.Disabled.Type  = secType;
                    security.Disabled.Value = readerSecurity.Value;

                    break;
                }
            } while (readerSecurity.MoveToNext());

            return(security);
        }
Beispiel #20
0
 public VariableBlock(Bind bind, SecurityDefinition security) :
     base(ControlTypes.VariableBlock, bind, security)
 {
 }
Beispiel #21
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(options =>
            {
                options.ReturnHttpNotAcceptable = true;
                options.OutputFormatters.RemoveType <HttpNoContentOutputFormatter>();
                options.InputFormatters.Add(new XmlSerializerInputFormatter(new MvcOptions()));
                options.OutputFormatters.Add(new XmlSerializerOutputFormatter());
                options.FormatterMappings.SetMediaTypeMappingForFormat("xml", "application/xml");
            });
            services.AddControllers();
            #region Health Checks
            services.AddHealthChecks();
            services.AddHealthChecksUI().AddInMemoryStorage();
            #endregion
            #region Identity Server Config
            IdentityServerSettings identityServerSettings = new IdentityServerSettings();
            Configuration.GetSection("IdentityServerSettings").Bind(identityServerSettings);
            services.AddAuthentication("Bearer")
            .AddIdentityServerAuthentication("Bearer", options =>
            {
                options.ApiName   = identityServerSettings.ApiName;
                options.Authority = identityServerSettings.Authority;
            });
            #endregion
            #region Swagger Config
            SwaggerGenSettings swaggerGenSettings = new SwaggerGenSettings();
            Configuration.GetSection("SwaggerGenSettings").Bind(swaggerGenSettings);
            services.AddSwaggerGen(options =>
            {
                options.SwaggerDoc(swaggerGenSettings.SwaggerDoc.name, swaggerGenSettings.SwaggerDoc.OpenApiInfo);
                SecurityDefinition securityDefinition = swaggerGenSettings.SecurityDefinition;
                Settings.Swagger.AuthorizationCode authorizationCode = securityDefinition.OpenApiSecurityScheme.AuthorizationCode;
                options.AddSecurityDefinition(securityDefinition.name, new OpenApiSecurityScheme
                {
                    Type  = securityDefinition.OpenApiSecurityScheme.SecuritySchemeType,
                    Flows = new OpenApiOAuthFlows
                    {
                        AuthorizationCode = new OpenApiOAuthFlow
                        {
                            AuthorizationUrl = new Uri(authorizationCode.AuthorizationUrl),
                            TokenUrl         = new Uri(authorizationCode.TokenUrl),
                            Scopes           = authorizationCode.Scopes
                        }
                    }
                });
                options.OperationFilter <AuthorizeCheckOperationFilter>();
            });
            #endregion
            #region Autofac Composition root
            // Install the container, using our configuration
            ContainerInstaller installer = new ContainerInstaller();
            ContainerBuilder   builder   = installer.Install();

            // Pull the .net core dependencies into the container, like controllers
            builder.Populate(services);

            IContainer container = builder.Build();
            #endregion
            // return the IServiceProvider implementation
            return(new AutofacServiceProvider(container));
        }
Beispiel #22
0
 protected Base(ControlTypes type, Bind bind, SecurityDefinition security)
 {
     this.Type     = type;
     this.Bind     = bind;
     this.Security = security;
 }