public IActionResult Index() { NameValueCollection coll; Dictionary <string, string> ss = Request.Headers.ToDictionary(a => a.Key, a => string.Join(";", a.Value)); var keys = new List <string>(ss.Keys); // Load Header collection into NameValueCollection object. Microsoft.AspNetCore.Http.IHeaderDictionary colxl = Request.Headers; /* * // Put the names of all keys into a string array. * String[] arr1 = coll.AllKeys; * for (loop1 = 0; loop1 < arr1.Length; loop1++) * { * //Response.Write("Key: " + arr1[loop1] + "<br>"); * // Get all values under this key. * String[] arr2 = coll.GetValues(arr1[loop1]); * for (loop2 = 0; loop2 < arr2.Length; loop2++) * { * // Response.Write("Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "<br>"); * } * } */ _logger.LogInformation("test date time: " + Dns.GetHostName() + " " + DateTime.Now.ToString() + keys.ToString()); return(View()); }
public void Report(HttpResponseHeaders headers, ApiVersionModel apiVersionModel) { Arg.NotNull(headers, nameof(headers)); Arg.NotNull(apiVersionModel, nameof(apiVersionModel)); AddApiVersionHeader(headers, ApiSupportedVersions, apiVersionModel.SupportedApiVersions); AddApiVersionHeader(headers, ApiDeprecatedVersions, apiVersionModel.DeprecatedApiVersions); }
public override void OnActionExecuting(ActionExecutingContext context) { Microsoft.AspNetCore.Http.IHeaderDictionary headers = context.HttpContext.Response.Headers; headers.Add("Access-Control-Allow-Origin", "*"); headers.Add("Access-Control-Allow-Headers", "*"); headers.Add("Access-Control-Allow-Credentials", "*"); base.OnActionExecuting(context); }
private JwtSecurityToken getAuthToken(Microsoft.AspNetCore.Http.IHeaderDictionary header) { var jwt = new JwtSecurityTokenHandler(); string auth = header["Authorization"]; if (auth.IndexOf("bearer") == 0) { auth = auth.Substring(7).Trim();// remove 'bearer '... } return(jwt.ReadJwtToken(auth)); }
static void AddApiVersionHeader(HttpResponseHeaders headers, string headerName, IReadOnlyList <ApiVersion> versions) { if (versions.Count > 0 && #if WEBAPI !headers.Contains(headerName)) #else !headers.ContainsKey(headerName)) #endif { headers.Add(headerName, Join(ValueSeparator, versions.Select(v => v.ToString()).ToArray())); } }
public static string PlainText(this Microsoft.AspNetCore.Http.IHeaderDictionary headerDictionary) { if (headerDictionary == null) { return(string.Empty); } var headers = headerDictionary .Keys .Select(key => $"{key}: {headerDictionary[key]}"); return(string.Join(", ", headers)); }
private string getUserID(Microsoft.AspNetCore.Http.IHeaderDictionary header) { string userID = ""; try { var token = getAuthToken(header); userID = token.Payload.First(p => p.Key == "sub").Value.ToString(); } catch (System.Exception ex) { // TODO: log error... } return(userID); }
public async void OnAuthorization(AuthorizationFilterContext context) { Microsoft.AspNetCore.Http.IHeaderDictionary headers = context.HttpContext.Request.Headers; Microsoft.AspNetCore.Http.HttpRequest request = context.HttpContext.Request; string tokenStr = headers["Authorization"].ToString().Replace("Bearer ", ""); IAuthHandler authHandler = _builder.Create <IAuthHandler>(); AuthenticateResult authResult = await context.HttpContext.AuthenticateAsync(JwtBearerDefaults.AuthenticationScheme); IToken token = _builder.Create <IToken>(); token.Value = tokenStr; if (authResult.Succeeded && authResult.Principal.Identity.IsAuthenticated && authHandler.Check(token)) { } else { context.Result = new ForbidResult(); } }
public void Report(HttpResponseHeaders headers, ApiVersionModel apiVersionModel) { AddApiVersionHeader(headers, ApiSupportedVersions, apiVersionModel.SupportedApiVersions); AddApiVersionHeader(headers, ApiDeprecatedVersions, apiVersionModel.DeprecatedApiVersions); }
public void Report(HttpResponseHeaders headers, Lazy <ApiVersionModel> apiVersionModel) => Report(headers, apiVersionModel.Value);
public static void SetCommaSeparatedValues(this Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, params string[] values) { }
public static string[] GetCommaSeparatedValues(this Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key) { throw null; }
public static void Append(this Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, Microsoft.Extensions.Primitives.StringValues value) { }
public WebSessionTokenProvider(Microsoft.AspNetCore.Http.IHeaderDictionary headerDictionary) { this.headerDictionary = headerDictionary; }
public void SetContext(Microsoft.AspNetCore.Http.IHeaderDictionary headerDictionary) { }
public static Microsoft.Extensions.Primitives.StringValues GetHeaderUnmodified(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key) { throw null; }
public ActionResult <List <Models.User> > GetAll() { Microsoft.AspNetCore.Http.HttpRequest request = Request; Microsoft.AspNetCore.Http.IHeaderDictionary header = request.Headers; return(users.GetAll().ToList()); }
public ResponseHeaders(Microsoft.AspNetCore.Http.IHeaderDictionary headers) { }
public ResponseCookies(Microsoft.AspNetCore.Http.IHeaderDictionary headers, Microsoft.Extensions.ObjectPool.ObjectPool <System.Text.StringBuilder> builderPool) { }
public User ObtenerDatosToken(Microsoft.AspNetCore.Http.IHeaderDictionary header, string tag) { try { var user = new User(); var tokenEnviado = new SSOEncodedToken(); tokenEnviado.Token = header.ContainsKey(tag) ? Convert.ToString(header[tag]) : string.Empty; if (!string.IsNullOrEmpty(tokenEnviado.Token) && tokenEnviado.Token.Length > 0) { credenciales = Credencial.ObtenerCredencialEnWs(tokenEnviado); if (credenciales != null) { //Entity - CUIT user.Entity = credenciales.Operation.Login.Entity; // user.HasToken = true; user.Sistema = credenciales.Operation.Login.System; //Perfil user.Perfil = credenciales.Operation.Login.Groups[0].Name; //Cuil user.CUIL = credenciales.Operation.Login.CUIL; //Legajo - Uid user.UserId = credenciales.Operation.Login.UId; //verificamos el grupo y la info //****************************** user.UserName = credenciales.Operation.Login.UserName; //deteccion del cuil - para CVSS en el campo UId estara el CUIL de la persona. //Para aplicaciones internas el UId tendra el Usuario del operador try { user.Cuip = string.IsNullOrEmpty(credenciales.Operation.Login.UId) ? 0 : long.Parse(credenciales.Operation.Login.UId); } catch { user.Cuip = 0; user.UserName = credenciales.Operation.Login.UId; } //Nombre user.Nombre = credenciales.Operation.Login.UserName; for (int i = 0; i < credenciales.Operation.Login.Info.Length; i++) { switch (credenciales.Operation.Login.Info[i].Name) { case "nombre": user.Nombre = credenciales.Operation.Login.Info[i].Value; break; case "ip": user.IP = credenciales.Operation.Login.Info[i].Value; break; case "oficina": user.Oficina = credenciales.Operation.Login.Info[i].Value; break; case "oficinadesc": user.OficinaDetalle = credenciales.Operation.Login.Info[i].Value; break; default: break; } } return(user); } throw new Exception("Ha ocurrido un error al obtener las credenciales del usuario, por favor verifique que ha enviado el token con sus credenciales"); } throw new Exception("Ha ocurrido un error al obtener el token, por favor verifique que el mismo fue enviado"); } catch (Exception ex) { log.Error("Credenciales - " + ex.Message); throw ex; } return(null); }
/// <summary> /// 获取Request中的Header指定key的值 /// </summary> /// <param name="heads"></param> /// <param name="key"></param> /// <returns></returns> public static string GetValue(this Microsoft.AspNetCore.Http.IHeaderDictionary heads, string key) { return(heads[key].FirstOrDefault()?.ToString() ?? ""); }
public void Report(HttpResponseHeaders headers, ApiVersionModel apiVersionModel) { }
public async Task <IReadOnlyCollection <LabTestItemDto> > GetLabTestItemsAsync(Microsoft.AspNetCore.Http.IHeaderDictionary headers) { foreach (var h in headers) { try{ httpClient.DefaultRequestHeaders.Add(h.Key, h.Value[0]); } catch { } } //httpClient.DefaultRequestHeaders.Add("authorization", "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InFiOXh6TzZYR1N4ZlllWm14b2lwUCJ9.eyJodHRwczovL2d1ZXN0eC5jb20vdXNlcl9tZXRhZGF0YSI6eyJmb3JjZVJlc2V0ICI6ImZhbHNlIiwidGVuYW50SWQiOjF9LCJodHRwczovL2d1ZXN0eC5jb20vcm9sZXMiOlsiQWRtaW4iXSwiaXNzIjoiaHR0cHM6Ly9zZWVjaXR5LmF1dGgwLmNvbS8iLCJzdWIiOiJhdXRoMHw1ZWJlZjA5YTc1Njc1YTBjNzQzMDU1ZDciLCJhdWQiOlsiaHR0cHM6Ly9zZWVjaXR5LmFkZnMuY29tIiwiaHR0cHM6Ly9zZWVjaXR5LmF1dGgwLmNvbS91c2VyaW5mbyJdLCJpYXQiOjE2MjE4NDAxNzEsImV4cCI6MTYyMTkyNjU3MSwiYXpwIjoiTzAyQW1ZcHEzSGJweXVIN0VveGlXMFlvRjZkMXJKQUwiLCJzY29wZSI6Im9wZW5pZCJ9.E7fvxs_l0O1-dnlRpATnFVc0TGbNnHOEFXsMiI797xRSSd4xxZCQYZ-Q63mdnVsT_B0ZyTiZ1rOMC9TwjPJr5lGvYIC0SdVF6Ez_epjosBCKcUyGUjlZ9_CkfibFYkekzlBt9WPKkbkMToVwPaQNe8e-Y-T96sV4uLYfGHkKT7aWGnKlWXE5j9wdomB0RltYHGrVeQF3zHAveKFUqdfh1h-Gm294HAoQjWWs66R3pSrjVdBcjucJaWRKl0CclNLVKRJsf9L7u05VogDzz_Djdoowt__FqPBEAp8jvOB-gpD6kzOTTHDWFP3MAQ7NctCvhXKLzTGBwjXNSxZIsY23lQ"); var items = await httpClient.GetFromJsonAsync <IReadOnlyCollection <LabTestItemDto> >("/clinician/labTests"); return(items); }
public static void SetHeaderUnmodified(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, Microsoft.Extensions.Primitives.StringValues?values) { }
public void Report(HttpResponseHeaders headers, Lazy <ApiVersionModel> apiVersionModel) { }
public RequestHeaders(Microsoft.AspNetCore.Http.IHeaderDictionary headers) { }
public static void AppendHeaderJoined(Microsoft.AspNetCore.Http.IHeaderDictionary headers, string key, params string[] values) { }
public static void AppendList <T>(this Microsoft.AspNetCore.Http.IHeaderDictionary Headers, string name, System.Collections.Generic.IList <T> values) { }
public AspNetHeaderDictionary(Microsoft.AspNetCore.Http.IHeaderDictionary headers) { this.headers = headers; }