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);
        }
Exemple #2
0
        /// <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);
        }
Exemple #4
0
 public FormsAuthInfo(HttpContextBase context, AuthStor stor) : base(context, stor)
 {
     init();
 }
Exemple #5
0
 public AuthInfo(HttpContextBase context, AuthStor stor)
 {
     init(context, stor);
 }
Exemple #6
0
 public AuthInfo(HttpContext context, AuthStor stor)
 {
     init(new HttpContextWrapper(context), stor);
 }
Exemple #7
0
 private void init(HttpContextBase context, AuthStor stor)
 {
     this.stor    = stor;
     this.context = context;
 }
Exemple #8
0
 public MixAuthInfo(HttpContext context, AuthStor stor) : base(context, stor)
 {
     init();
 }
Exemple #9
0
 public PortalAuthInfo(HttpContextBase context, AuthStor stor) : base(context, stor)
 {
     init();
 }