Пример #1
0
 /// <summary>
 /// 自定义授权检查
 /// </summary>
 /// <param name="httpContext">
 /// <para>HTTP 上下文</para>
 /// <para>封装有关单个 HTTP 请求的所有 HTTP 特定的信息</para>
 /// </param>
 /// <returns>执行结果</returns>
 protected override bool AuthorizeCore(HttpContextBase httpContext)
 {
     if (httpContext == null)
     {
         return(false);
     }
     if (httpContext.User.Identity.IsAuthenticated)
     {
         if (DawnAuthlib.UserId > 0 && !string.IsNullOrEmpty(DawnAuthlib.UserName) && DawnAuthlib.UserInfo != null)
         {
             if (!string.IsNullOrEmpty(ModuleCode) && StatusMark > -1)
             {
                 if (IsAllow() && base.AuthorizeCore(httpContext))
                 {
                     return(true);
                 }
                 httpContext.Response.StatusCode = 403;
             }
         }
         else
         {
             DawnAuthlib.ClearLogin();
             httpContext.Response.StatusCode = 401;
         }
     }
     return(false);
 }
Пример #2
0
 /// <summary>
 /// 验证授权
 /// </summary>
 /// <returns>执行结果</returns>
 private bool IsAllow()
 {
     return(DawnAuthlib.VerifyStatus(ModuleCode, StatusMark));
 }
Пример #3
0
 /// <summary>
 /// 验证授权
 /// </summary>
 /// <returns>执行结果</returns>
 private bool IsAllow()
 {
     return(DawnAuthlib.VerifyModule(ModuleCode, FunctionMark));
 }