UserAuthenticationHandler.cs 853 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Linq;
  3. using System.Threading.Tasks;
  4. using MediaBrowser.Common.Net.Handlers;
  5. using MediaBrowser.Controller;
  6. using MediaBrowser.Model.DTO;
  7. using MediaBrowser.Model.Entities;
  8. namespace MediaBrowser.Api.HttpHandlers
  9. {
  10. class UserAuthenticationHandler : BaseSerializationHandler<AuthenticationResult>
  11. {
  12. protected override async Task<AuthenticationResult> GetObjectToSerialize()
  13. {
  14. Guid userId = Guid.Parse(QueryString["userid"]);
  15. User user = Kernel.Instance.Users.First(u => u.Id == userId);
  16. string password = await GetFormValue("password").ConfigureAwait(false);
  17. AuthenticationResult result = new AuthenticationResult()
  18. {
  19. Success = true
  20. };
  21. return result;
  22. }
  23. }
  24. }