Exemplo n.º 1
0
        public void From(Gateway gateway)
        {
            this.BufferSize  = gateway.BufferSize;
            this.PoolMaxSize = gateway.PoolMaxSize;
            foreach (var server in gateway.Agents.Servers)
            {
                Servers.Add(new ServerInfo {
                    MaxConnections = server.MaxConnections, Uri = server.Uri.ToString(), Remark = server.Remark, Category = server.Category
                });
            }
            this.OutputServerAddress   = gateway.OutputServerAddress;
            this.AgentMaxConnection    = gateway.AgentMaxConnection;
            this.AgentRequestQueueSize = gateway.AgentRequestQueueSize;
            this.GatewayQueueSize      = gateway.GatewayQueueSize;
            this.InstanceID            = gateway.InstanceID;
            UrlConfig urlConfig = new UrlConfig();

            urlConfig.From(gateway.Routes.Default);
            Urls.Add(urlConfig);
            foreach (var route in gateway.Routes.Urls)
            {
                urlConfig = new UrlConfig();
                urlConfig.From(route);
                Urls.Add(urlConfig);
            }
            this.PluginConfig  = new PluginConfig(gateway.Pluginer);
            this.PluginsStatus = gateway.PluginCenter.PluginsStatus;
        }
Exemplo n.º 2
0
        public LuisService(UrlConfig urlConfig, string spellCheckerKey)
        {
            if (urlConfig == null)
            {
                throw new ArgumentNullException(nameof(urlConfig));
            }

            if (String.IsNullOrEmpty(urlConfig.Url))
            {
                throw new ArgumentNullException(nameof(urlConfig) + ".Url");
            }

            if (String.IsNullOrEmpty(urlConfig.Key))
            {
                throw new ArgumentNullException(nameof(urlConfig) + ".Key");
            }

            this.BaseUrl         = urlConfig.Url;
            this.SpellCheckerKey = spellCheckerKey;

            lock (client)
            {
                if (!client.DefaultRequestHeaders.Contains("Ocp-Apim-Subscription-Key"))
                {
                    client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", urlConfig.Key);
                }
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> load()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <BadgeEntity>(json);

            // load all badges
            var _posts = await BadgeBLL.Load(_context, data);

            // load all categories
            var _categories = await GA_CategoryBLL.Load(_context, new GACategoryEntity()
            {
            });

            foreach (var item in _posts)
            {
                item.img_url = UrlConfig.Return_Badge_Image(item.icon);
            }

            var _records = 0;

            if (data.id == 0)
            {
                _records = BadgeBLL.Count(_context, data);
            }


            return(Ok(new { posts = _posts, records = _records, categories = _categories }));
        }
Exemplo n.º 4
0
    // Core script to handle website layout
    private void Process_Layout()
    {
        UGeneral ug = new UGeneral();
        int      selected_layout_option = Site_Settings.NavigationSection;

        if (selected_layout_option == 2)
        {
            // three column layout
            navigation1.Visible    = false; // advance navigation disable
            navigation_sm1.Visible = true;  // first column simple navigation
            third_nav1.Visible     = true;  // third column navigation
        }
        else
        {
            // two column layout
            navigation1.Visible    = true;
            navigation_sm1.Visible = false;
            third_nav1.Visible     = false;
        }

        NavigationClass = ug.Return_Navigation_Class();
        BodyClass       = ug.Return_Body_Class();
        BodyRight       = ug.Return_RightNav_Class();

        // set meta information
        HtmlHead head             = (HtmlHead)Page.Header;
        string   meta_title       = "Advance Channel Search";
        string   meta_description = "You can search user profiles and channels through list of advance search options available on this page";

        MetaTagsBLL.META_StaticPage(this.Page, head, meta_title, meta_description, UrlConfig.Return_Website_Logo_Url(), Config.GetUrl("channel/searchoptions.aspx"));
    }
        private async Task <string> GetAuthTokenAsync()
        {
            var request = new HttpRequestMessage(HttpMethod.Post, UrlConfig.Authorize());

            var content = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("grant_type", "client_credentials")
            };

            request.Content = new FormUrlEncodedContent(content);

            var authHeader = Base64UrlEncoder.Encode($"{_appSettings.ClientId}:{_appSettings.ClientSecret}");

            request.Headers.Add("Authorization", $"Basic {authHeader}");

            var client   = _clientFactory.CreateClient();
            var response = await client.SendAsync(request);

            if (!response.IsSuccessStatusCode)
            {
                throw new Exception("Unable to Authenticate with SpotifyId servers.");
            }

            var json = await response.Content.ReadAsStringAsync();

            var token = JsonConvert.DeserializeObject <AuthResponse>(json);

            return($"{token.TokenType} {token.AccessToken}");
        }
 public void Load(UrlConfig urlConfig, ConfigNode node)
 {
     this._resourceUrl        = urlConfig.Url;
     this._urlConfig          = urlConfig;
     this._configFileFullName = urlConfig.Parent.FullPath;
     this.Load(node);
 }
Exemplo n.º 7
0
    static void ConfigureJwtBearerOptions(JwtBearerOptions opts, UrlConfig urlConfig)
    {
        opts.Authority = urlConfig.Auth;
        opts.Audience  = "maw_api_resource";

        // https://damienbod.com/2017/10/16/securing-an-angular-signalr-client-using-jwt-tokens-with-asp-net-core-and-identityserver4/
        opts.Events = new JwtBearerEvents {
            OnMessageReceived = context =>
            {
                var isUploadr = context.Request.Path.Value?.StartsWith("/uploadr", true, CultureInfo.InvariantCulture) ?? false;

                if (isUploadr && context.Request.Query.TryGetValue("token", out StringValues token))
                {
                    context.Token = token;
                }

                return(Task.CompletedTask);
            },
            OnAuthenticationFailed = context =>
            {
                var te = context.Exception;
                return(Task.CompletedTask);
            }
        };
    }
 private HostString GetHost(UrlConfig urlConfig)
 {
     if (urlConfig.HttpsPort.HasValue)
     {
         if (urlConfig.HttpsPort.Value == 443 || urlConfig.HttpsPort.Value <= 0)
         {
             return(new HostString(urlConfig.CanonicalHost));
         }
         else
         {
             return(new HostString(urlConfig.CanonicalHost, urlConfig.HttpsPort.Value));
         }
     }
     else if (urlConfig.HttpPort.HasValue)
     {
         if (urlConfig.HttpPort == 80 || urlConfig.HttpPort.Value <= 0)
         {
             return(new HostString(urlConfig.CanonicalHost));
         }
         else
         {
             return(new HostString(urlConfig.CanonicalHost, urlConfig.HttpPort.Value));
         }
     }
     else
     {
         return(new HostString(urlConfig.CanonicalHost));
     }
 }
Exemplo n.º 9
0
    private string ProcessThumb(Member_Struct ph)
    {
        StringBuilder str = new StringBuilder();

        if (this.ThumbCssClass == "")
        {
            this.ThumbCssClass = "thumbnail";
        }
        // photo thumb
        string image_src = UrlConfig.Return_User_Profile_Photo(ph.UserName, ph.PictureName, this.ThumbPreviewOption, 0);

        if (ph.PictureName == "none" || ph.PictureName == "")
        {
            image_src = Config.GetUrl("images/dmember.png");
        }
        else if (ph.PictureName.Contains("http"))
        {
            image_src = ph.PictureName;
        }

        str.Append("<a class=\"" + ThumbCssClass + "\" style=\"width:" + this.Width + "px;\" href=\"" + this.PreviewUrl + "\" title=\"" + ph.UserName + "\">"); // thumb link setup

        str.Append("<img  src=\"" + image_src + "\" height=\"" + this.Height + "\" width=\"" + this.Width + "\">");
        str.Append("</a>");
        return(str.ToString());
    }
Exemplo n.º 10
0
        public TaskEntity Add([FromBody] TaskDto taskDto, int idProject, int idJalon)
        {
            TaskEntity task = new TaskEntity()
            {
                AssigneeId       = taskDto.AssigneeId,
                Label            = taskDto.Label,
                PlannedStartDate = taskDto.PlannedStartDate,
                PlannedEndDate   = taskDto.PlannedStartDate.AddDays(taskDto.Cost),
                RealStartDate    = taskDto.RealStartDate,
                RealEndDate      = taskDto.RealEndDate,
                Cost             = taskDto.Cost,
                Description      = taskDto.Description,
                Exigences        = taskDto.Exigences,
                JalonId          = idJalon,
                RequiredTask     = taskDto.RequiredTaskId,
            };


            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject, IdJalon = idJalon
            };

            return(_TaskService.Add(task, config));
        }
Exemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Site_Settings.NavigationSection == 1)
        {
            // right side navigation
            NavigationClass = "chnl_right_nav";
            BodyClass       = "chnl_left_mn";
        }
        // globalization text
        btn_login.Text = Resources.vsk.submit;

        if (!Page.IsPostBack)
        {
            if (Request.Params["status"] != null)
            {
                switch (Request.Params["status"].ToString())
                {
                case "invalid":
                    Config.ShowMessageV2(msg, "Error validation key and username", "Error!", 0);
                    break;
                }
            }
            pnl_result.Visible = false;
        }

        // set meta information
        HtmlHead head             = (HtmlHead)Page.Header;
        string   meta_title       = Resources.vsk.meta_forgotpassword_title;
        string   meta_description = Resources.vsk.meta_forgotpassword_description;

        MetaTagsBLL.META_StaticPage(this.Page, head, meta_title, meta_description, UrlConfig.Return_Website_Logo_Url(), Config.GetUrl("forgotpassword.aspx"));
    }
Exemplo n.º 12
0
    public string Process(Comment_Struct grp)
    {
        this.AuthorUrl = UrlConfig.Prepare_User_Profile_Url(grp.UserName, this.isAdmin);

        StringBuilder str            = new StringBuilder();
        string        reply_pad      = "";
        string        container_size = "100%";

        if (grp.ReplyID > 0)
        {
            reply_pad      = "padding-left:3%;";
            container_size = "97%";
        }
        // don't remove class name "vskcmtcnt" its internal use only
        str.Append("<div id=\"citem_" + grp.CommentID + "\" class=\"vskcmtcnt\" style=\"width:" + container_size + ";" + reply_pad + ";\">\n");
        str.Append("<div id=\"cmsg_" + grp.CommentID + "\"></div>\n"); // to display runtime messages
        str.Append("<div class=\"" + this.BoxCssClass + "\">\n");
        string container = "class=\"item_pad_2\"";

        if (this.isHoverEffect)
        {
            container = "class=\"" + this.HoverCssClass + "\"";
        }
        if (this.isAltColor)
        {
            container = "class=\"" + this.AltCssClass + "\"";
        }
        str.Append("<div " + container + ">\n");
        switch (this.TemplateID)
        {
        case 0:
            // youtube style comment style
            str.Append(YoutubeStyleTemplate(grp));
            break;

        case 1:
            // Facebook style comment
            str.Append(FBStyleTemplate(grp));
            break;

        case 2:
            // Blog style comment
            str.Append(BlogStyleTemplate(grp));
            break;

        case 3:
            // Simple Style
            str.Append(ProcessContent_Simple(grp));
            break;
        }
        str.Append("</div>\n"); //close hover box
        str.Append("</div>\n"); // close box css class
        str.Append("</div>\n"); // close main box

        // reset urls for next itemgroup
        this.AuthorUrl = "";

        return(str.ToString());
    }
Exemplo n.º 13
0
 public void Setup()
 {
     urlConfig = new UrlConfig()
     {
         CanonicalHost = "www.foo.bar", HttpPort = 80, HttpsPort = 443
     };
     rule = new RedirectToCanonicalHostRule(urlConfig);
 }
        //UIConfig _uiConfig;

        public RequestEmailHandler(IRepository <Review, int> revRepository, UserManager <User> userManager, IEmailService mailer, IOptions <UrlConfig> uiConfig, IRazorViewToStringRenderer razorViewToStringRenderer)
        {
            _reviewRepository          = revRepository;
            _userManager               = userManager;
            _mailer                    = mailer;
            _uiConfig                  = uiConfig.Value;
            _razorViewToStringRenderer = razorViewToStringRenderer;
        }
 /// <summary>
 /// Конструктор базового сервиса Http клиента
 /// </summary>
 /// <param name="client">Http клиент</param>
 /// <param name="accessor">Текущий Http клиент</param>
 /// <param name="options">Конфигурация подключения клиента</param>
 public BaseService(HttpClient client,
                    IHttpContextAccessor accessor,
                    IOptionsMonitor <UrlConfig> options)
 {
     _client   = client;
     _accessor = accessor;
     _options  = options.CurrentValue;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // set meta information
        HtmlHead head             = (HtmlHead)Page.Header;
        string   meta_title       = Resources.vsk.meta_terms_title;
        string   meta_description = Resources.vsk.meta_terms_description;

        MetaTagsBLL.META_StaticPage(this.Page, head, meta_title, meta_description, UrlConfig.Return_Website_Logo_Url(), Config.GetUrl("terms.aspx"));
    }
Exemplo n.º 17
0
        public List <JalonEntity> FindAll(int idProject)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject
            };

            return(_jalonService.FindAll(config));
        }
Exemplo n.º 18
0
        public UserEntity FindOne(int idUser)
        {
            UrlConfig config = new UrlConfig()
            {
                IdUser = idUser
            };

            return(_UserService.FindOne(config));
        }
Exemplo n.º 19
0
        public List <TaskEntity> FindAll(int idProject, int idJalon)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject, IdJalon = idJalon
            };

            return(_TaskService.FindAll(config));
        }
Exemplo n.º 20
0
        public TaskEntity FindOne(int idProject, int idJalon, int idTask)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject, IdJalon = idJalon, IdTask = idTask
            };

            return(_TaskService.FindOne(config));
        }
Exemplo n.º 21
0
        public List <TaskEntity> Remove(int idProject, int idJalon, int idTask)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject, IdJalon = idJalon, IdTask = idTask
            };

            return(_TaskService.Remove(config));
        }
Exemplo n.º 22
0
        public JalonEntity FindOne(int idProject, int idJalon)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject, IdJalon = idJalon
            };

            return(_jalonService.FindOne(config));
        }
Exemplo n.º 23
0
        public List <JalonEntity> Remove(int idProject, int idJalon)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject, IdJalon = idJalon
            };

            return(_jalonService.Remove(config));
        }
Exemplo n.º 24
0
        public ProjectEntity FindOne(int idProject)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject
            };

            return(_projectService.FindOne(config));
        }
Exemplo n.º 25
0
        public List <ExigenceEntity> FindAll(int idProject)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject
            };

            return(_exigenceService.FindAll(config));
        }
Exemplo n.º 26
0
        public ExigenceEntity FindOne(int idExigence, int idProject)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject, IdExigence = idExigence
            };

            return(_exigenceService.FindOne(config));
        }
Exemplo n.º 27
0
        public List <ExigenceEntity> Remove(int idProject, int idExigence)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject, IdExigence = idExigence
            };

            return(_exigenceService.Remove(config));
        }
Exemplo n.º 28
0
        public List <ProjectEntity> Remove(int idProject)
        {
            UrlConfig config = new UrlConfig()
            {
                IdProject = idProject
            };

            return(_projectService.Remove(config));
        }
 public AuthorizationClientService(HttpClient client, IOptionsMonitor <UrlConfig> options, IHttpContextAccessor accessor)
     : base(client, accessor, options)
 {
     _options            = options.CurrentValue;
     _client             = client;
     _accessor           = accessor;
     _client.BaseAddress = new Uri(_options.AuthenticateUrl);
     _client.DefaultRequestHeaders.Add("Accept", "*/*");
 }
Exemplo n.º 30
0
        public ProjectEntity Add([FromBody] ProjectDto projectDto)
        {
            var project = new ProjectEntity
            {
                Label      = projectDto.Label,
                AssigneeId = projectDto.AssigneeId
            };
            UrlConfig config = new UrlConfig();

            return(_projectService.Add(project, config));
        }