1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-28 19:05:55 +00:00
Radarr/NzbDrone.Api/Authentication/AuthenticationValidator.cs

32 lines
858 B
C#
Raw Normal View History

2013-05-22 00:58:57 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nancy.Authentication.Basic;
using Nancy.Security;
using NzbDrone.Common;
namespace NzbDrone.Api.Authentication
{
public class AuthenticationValidator : IUserValidator
{
private readonly IConfigFileProvider _configFileProvider;
public AuthenticationValidator(IConfigFileProvider configFileProvider)
{
_configFileProvider = configFileProvider;
}
public IUserIdentity Validate(string username, string password)
{
if (_configFileProvider.BasicAuthUsername.Equals(username) &&
_configFileProvider.BasicAuthPassword.Equals(password))
{
return new NzbDroneUser { UserName = username};
}
return null;
}
}
}