IUserHelper.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using GreenTree.Nachtragsmanagement.Core.Domain.User;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace GreenTree.Nachtragsmanagement.Core.Authentication
  8. {
  9. public interface IUserHelper
  10. {
  11. /// <summary>
  12. /// Evaluates the current user from request cookies
  13. /// </summary>
  14. User FromCookies();
  15. /// <summary>
  16. /// Evaluates the current user from request cookies
  17. /// </summary>
  18. /// <param name="expirationHoursIncrease">The hours the authCookie will be increased if it exists.</param>
  19. User FromCookies(int expirationHoursIncrease);
  20. /// <summary>
  21. /// Writes the current user to response cookies
  22. /// </summary>
  23. /// <param name="user">The current authenticated user.</param>
  24. void ToCookies(User user);
  25. /// <summary>
  26. /// Writes the current user to response cookies
  27. /// </summary>
  28. /// <param name="user">The current authenticated user.</param>
  29. /// <param name="setRequestCookie">Set also the request cookie for further authorization.</param>
  30. void ToCookies(User user, bool setRequestCookie);
  31. /// <summary>
  32. /// Writes the current user to response cookies
  33. /// </summary>
  34. /// <param name="user">The current authenticated user.</param>
  35. /// <param name="expirationDate">The cookie expiration date.</param>
  36. void ToCookies(User user, DateTime expirationDate);
  37. /// <summary>
  38. /// Writes the current user to response cookies
  39. /// </summary>
  40. /// <param name="user">The current authenticated user.</param>
  41. /// <param name="expirationDate">The cookie expiration date.</param>
  42. /// <param name="setRequestCookie">Set also the request cookie for further authorization.</param>
  43. void ToCookies(User user, DateTime expirationDate, bool setRequestCookie);
  44. /// <summary>
  45. /// Clears the authentication cookie
  46. /// </summary>
  47. void ClearCookie();
  48. }
  49. }