Пример #1
0
        public IActionResult GetClientRequestParameters([FromRoute] string clientId)
        {
            var parameters = _clientRequestParametersProvider.GetClientParameters(HttpContext, clientId);

            //logger.LogInformation($"||||||||||||||||||||||||||||||||||: {clientId}");
            return(Ok(parameters));
        }
        public ClientInfo GetClient()
        {
            const string ReturnUrl        = "returnUrl";
            const string ClientId         = "client_id";
            const string CallbackClientId = "/connect/authorize/callback?client_id";

            var query = _httpContextAccessor.HttpContext.Request.Query;

            if (query.ContainsKey(ReturnUrl))
            {
                var returnUrl   = query[ReturnUrl];
                var parsedQuery = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(returnUrl);

                var clientId = parsedQuery.FirstOrDefault(q => q.Key == ClientId || q.Key == CallbackClientId);

                if (!string.IsNullOrEmpty(clientId.Value))
                {
                    var clientParameters = _clientRequestParameters.GetClientParameters(_httpContextAccessor.HttpContext, clientId.Value);
                    clientParameters.TryGetValue("redirect_uri", out var clientRedirectUri);
                    var uri        = new Uri(clientRedirectUri);
                    var clientUrl  = uri.AbsoluteUri.Substring(0, uri.AbsoluteUri.IndexOf("authentication"));
                    var clientInfo = new ClientInfo
                    {
                        ClientId  = clientId.Value,
                        ClientUri = clientUrl
                    };

                    return(clientInfo);
                }
            }

            return(new ClientInfo());
        }
        public IDictionary <string, string> GetClientRequestParameters([FromRoute] string clientId)
        {
            var parameters = (
                _clientRequestParametersProvider.GetClientParameters(HttpContext, clientId)
                );

            return(parameters);
        }
        public IActionResult GetClientParameters(string clientId)
        {
            var parameters = _clientRequestParametersProvider.GetClientParameters(HttpContext, clientId);

            if (parameters == null)
            {
                return(BadRequest($"Parameters for client '{clientId}' not found."));
            }
            else
            {
                return(Ok(parameters));
            }
        }
        /// <inheritdoc />
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var parameters = _clientRequestParametersProvider.GetClientParameters(ViewContext.HttpContext, ClientId);

            if (parameters == null)
            {
                throw new InvalidOperationException($"Parameters for client '{ClientId}' not found.");
            }

            foreach (var parameter in parameters)
            {
                output.Attributes.Add("data-" + parameter.Key, parameter.Value);
            }
        }
Пример #6
0
        public ActionResult <IDictionary <string, string> > GetClientRequestParameters([FromRoute] string clientId)
        {
            IDictionary <string, string> parameters;

            try
            {
                parameters = _provider.GetClientParameters(HttpContext, clientId);
            }
            catch (InvalidOperationException)
            {
                return(BadRequest());
            }

            return(Ok(parameters));
        }
Пример #7
0
        public IActionResult GetClientRequestParameters([FromRoute] string clientId)
        {
            var parameters = _clientRequestParametersProvider.GetClientParameters(HttpContext, clientId);

            return(Ok(parameters));
        }