private void Initialise() { _iDCredential = new DCredential(); _iFCredential = new FCredential(_iDCredential); _iDRole = new DRole(); _iFRole = new FRole(_iDRole); }
public AuthorizationProvider() { _iDCredential = new DCredential(); _iFCredential = new FCredential(_iDCredential); _iDCredentialRole = new DCredentialRole(); _iFCredentialRole = new FCredentialRole(_iDCredentialRole); }
public override void OnAuthorization(AuthorizationContext filterContext) { bool authorized = false; if (AllowAnonymous || (Cookies.IsLoggedIn && AllowedRoles.Length == 0)) { authorized = true; } else if (Cookies.IsLoggedIn) { _iDCredential = new DCredential(); _iDRole = new DRole(); _iFCredential = new FCredential(_iDCredential); _iFRole = new FRole(_iDRole); authorized = _iFRole.HasRole(Cookies.CredentialId, AllowedRoles); } if (!authorized && !string.IsNullOrEmpty(RedirectController) && !string.IsNullOrEmpty(RedirectMethod)) { filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = RedirectController, action = RedirectMethod })); } else if (!authorized) { filterContext.Result = new HttpUnauthorizedResult(); } }
public MvcAuthorizationFilterAttribute(bool allowAnonymous, string redirectController, string redirectMethod, string[] allowedRoles) { AllowAnonymous = allowAnonymous; AllowedRoles = allowedRoles; RedirectController = redirectController; RedirectMethod = redirectMethod; _iDCredential = new DCredential(); _iDRole = new DRole(); _iFCredential = new FCredential(_iDCredential); _iFRole = new FRole(_iDRole); }
public MvcAuthorizationFilterAttribute(bool allowAnonymous) { AllowAnonymous = allowAnonymous; RedirectController = string.Empty; RedirectMethod = string.Empty; AllowedRoles = new string[0]; _iDCredential = new DCredential(); _iDRole = new DRole(); _iFCredential = new FCredential(_iDCredential); _iDRole = new DRole(); _iFRole = new FRole(_iDRole); }
public FCredential() { _iDCredential = new DCredential(); }
public FCredential(IDCredential iDCredential) { _iDCredential = iDCredential; }