//public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext) //{ // if (Active) // { // var identity = ParseAuthorizationHeader(actionContext); // if (identity == null) // { // Challenge(actionContext); // return; // } // if (!OnAuthorizeUser(identity.Name, identity.Password, actionContext)) // { // Challenge(actionContext); // return; // } // var principal = new GenericPrincipal(identity, null); // if (HttpContext.Current != null) // { // HttpContext.Current.User = principal; // } // base.OnAuthorization(actionContext); // } //} protected virtual bool OnAuthorizeUser(string username, string password, HttpActionContext actionContext) { // we can write db validations here bool status = false; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { return(status); } using (MeetingManagementEntities db = new MeetingManagementEntities()) { status = db.Users.Any(t => t.Username == username); } return(status); }
public MMARepository(MeetingManagementEntities context) { _context = context; }