Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. public class SignalrQsHeaderMiddleware
  2. {
  3. private readonly RequestDelegate _next;
  4.  
  5. public SignalrQsHeaderMiddleware(RequestDelegate next)
  6. {
  7. this._next = next;
  8. }
  9.  
  10. public async Task Invoke(HttpContext context)
  11. {
  12. /*
  13. if (context.Request.Path.Value.Contains("/restaurantHub"))
  14. {
  15. var qsHeader = context.Request.Query["access_token"].ToString();
  16. if (!qsHeader.IsNullOrEmpty())
  17. {
  18. context.Request.Headers.Add("Authorization",qsHeader);
  19. }
  20. }*/
  21. await _next.Invoke(context);
  22.  
  23. }
  24. }
  25.  
  26. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  27. {
  28. //Other services.
  29. app.UseMiddleware<SignalrQsHeaderMiddleware>();//<-- added here
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement