UserAuthenticationHandler.cs 830 B

1234567891011121314151617181920212223242526
  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(await GetFormValue("userid").ConfigureAwait(false));
  15. User user = Kernel.Instance.Users.First(u => u.Id == userId);
  16. string password = await GetFormValue("password").ConfigureAwait(false);
  17. return new AuthenticationResult()
  18. {
  19. Success = true
  20. };
  21. }
  22. }
  23. }