2012-09-07 16:17:39 +00:00
|
|
|
|
using MediaBrowser.Common.Net.Handlers;
|
2012-09-06 18:38:29 +00:00
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
|
using MediaBrowser.Model.Entities;
|
2012-09-07 16:17:39 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2012-09-06 18:38:29 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api.HttpHandlers
|
|
|
|
|
{
|
|
|
|
|
class UserAuthenticationHandler : BaseSerializationHandler<AuthenticationResult>
|
|
|
|
|
{
|
|
|
|
|
protected override async Task<AuthenticationResult> GetObjectToSerialize()
|
|
|
|
|
{
|
2012-09-07 16:17:39 +00:00
|
|
|
|
string userId = await GetFormValue("userid").ConfigureAwait(false);
|
|
|
|
|
User user = ApiService.GetUserById(userId, false);
|
2012-09-06 18:38:29 +00:00
|
|
|
|
|
|
|
|
|
string password = await GetFormValue("password").ConfigureAwait(false);
|
|
|
|
|
|
2012-09-07 16:17:39 +00:00
|
|
|
|
return Kernel.Instance.AuthenticateUser(user, password);
|
2012-09-06 18:38:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|