|
using System.Security.Principal;
using System.ServiceModel.DomainServices.Hosting;
using System.ServiceModel.DomainServices.Server.ApplicationServices;
namespace ContactLOB.Web.Services
{
/// <summary>
/// RIA Services DomainService responsible for authenticating users when
/// they try to log on to the application.
///
/// Most of the functionality is already provided by the base class
/// AuthenticationBase
/// </summary>
[EnableClientAccess]
public class AuthenticationDomainService : AuthenticationBase<WebUser>
{
protected override WebUser GetAuthenticatedUser(IPrincipal principal)
{
// TODO: Add code to retreive user info from database
WebUser user = new WebUser();
user.Name = principal.Identity.Name;
user.FirstName = "Bill";
user.LastName = "Gates";
return user;
}
protected override bool ValidateUser(string userName, string password)
{
// TODO: Add code to check user credentials against database
string usrName = "demo";
string pswHash = "fe01ce2a7fbac8fafaed7c982a04e229";
return (usrName.Equals(userName) && pswHash.Equals(password));
}
}
public class WebUser : UserBase
{
public string UserId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public bool IsAdmin { get; set; }
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.