PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Microsoft.AspNet.SignalR.Core/Hubs/HubCallerContext.cs

https://github.com/belanger-simon/SignalR
C# | 71 lines | 44 code | 8 blank | 19 comment | 0 complexity | 7f402f47cd21ea8a1b8bd4db1e949170 MD5 | raw file
Possible License(s): Apache-2.0, CC-BY-SA-3.0
  1. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
  2. using System.Collections.Generic;
  3. using System.Collections.Specialized;
  4. using System.Security.Principal;
  5. namespace Microsoft.AspNet.SignalR.Hubs
  6. {
  7. public class HubCallerContext
  8. {
  9. /// <summary>
  10. /// Gets the connection id of the calling client.
  11. /// </summary>
  12. public string ConnectionId { get; private set; }
  13. /// <summary>
  14. /// Gets the cookies for the request.
  15. /// </summary>
  16. public IDictionary<string, Cookie> RequestCookies
  17. {
  18. get
  19. {
  20. return Request.Cookies;
  21. }
  22. }
  23. /// <summary>
  24. /// Gets the headers for the request.
  25. /// </summary>
  26. public NameValueCollection Headers
  27. {
  28. get
  29. {
  30. return Request.Headers;
  31. }
  32. }
  33. /// <summary>
  34. /// Gets the querystring for the request.
  35. /// </summary>
  36. public NameValueCollection QueryString
  37. {
  38. get
  39. {
  40. return Request.QueryString;
  41. }
  42. }
  43. /// <summary>
  44. /// Gets the <see cref="IPrincipal"/> for the request.
  45. /// </summary>
  46. public IPrincipal User
  47. {
  48. get
  49. {
  50. return Request.User;
  51. }
  52. }
  53. /// <summary>
  54. /// Gets the <see cref="IRequest"/> for the current HTTP request.
  55. /// </summary>
  56. public IRequest Request { get; private set; }
  57. public HubCallerContext(IRequest request, string connectionId)
  58. {
  59. ConnectionId = connectionId;
  60. Request = request;
  61. }
  62. }
  63. }