public AuthInfo GetAuthInfo(HttpContextBase context, AuthStor stor) { string method = stor.GetAuthMethod(); switch (method) { case "forms": authInfo = new FormsAuthInfo(context, stor); break; case "mix": authInfo = new MixAuthInfo(context, stor); break; case "portal": authInfo = new PortalAuthInfo(context, stor); break; default: authInfo = new FormsAuthInfo(context, stor); break; } return(authInfo); }
/// <summary> /// 取得 AuthStor 物件 /// </summary> /// <param name="context">目前正在使用的 HttpContext</param> /// <param name="storName">欲使用的儲存機制</param> /// <returns></returns> public AuthStor GetAuthStor(HttpContextBase context, string storName) { switch (storName.ToLower()) { case "web": authStor = new WebAuthStor(context); break; default: break; } return(authStor); }
public override void OnAuthorization(AuthorizationContext filterContext) { var context = filterContext.HttpContext; string storName = WebConfigurationManager.AppSettings["AUTH_STOR"]; authStorFactory = new AuthStorFactory(); authInfoFactory = new AuthInfoFactory(); authStor = authStorFactory.GetAuthStor(context, storName); authInfo = authInfoFactory.GetAuthInfo(context, authStor); // AuthorizationCore() will be called by base.OnAuthorization() base.OnAuthorization(filterContext); }
public FormsAuthInfo(HttpContextBase context, AuthStor stor) : base(context, stor) { init(); }
public AuthInfo(HttpContextBase context, AuthStor stor) { init(context, stor); }
public AuthInfo(HttpContext context, AuthStor stor) { init(new HttpContextWrapper(context), stor); }
private void init(HttpContextBase context, AuthStor stor) { this.stor = stor; this.context = context; }
public MixAuthInfo(HttpContext context, AuthStor stor) : base(context, stor) { init(); }
public PortalAuthInfo(HttpContextBase context, AuthStor stor) : base(context, stor) { init(); }