UserAuthenticationHandler.cs 702 B

1234567891011121314151617181920
  1. using MediaBrowser.Common.Net.Handlers;
  2. using MediaBrowser.Controller;
  3. using MediaBrowser.Model.Entities;
  4. using System.Threading.Tasks;
  5. namespace MediaBrowser.Api.HttpHandlers
  6. {
  7. class UserAuthenticationHandler : BaseSerializationHandler<AuthenticationResult>
  8. {
  9. protected override async Task<AuthenticationResult> GetObjectToSerialize()
  10. {
  11. string userId = await GetFormValue("userid").ConfigureAwait(false);
  12. User user = ApiService.GetUserById(userId, false);
  13. string password = await GetFormValue("password").ConfigureAwait(false);
  14. return Kernel.Instance.AuthenticateUser(user, password);
  15. }
  16. }
  17. }