Example #1
0
 /// <summary>
 /// 获取当前应用程序编码
 /// </summary>
 /// <param name="session">用户会话</param>
 public static string GetApplicationCode(this ISession session)
 {
     return(Web.Identity.GetValue(ClaimTypes.ApplicationCode));
 }
Example #2
0
 /// <summary>
 /// 获取当前应用程序标识
 /// </summary>
 /// <param name="session">用户会话</param>
 public static Guid GetApplicationId(this ISession session)
 {
     return(Web.Identity.GetValue(ClaimTypes.ApplicationId).ToGuid());
 }
Example #3
0
 /// <summary>
 /// 获取当前应用程序标识
 /// </summary>
 /// <param name="session">用户会话</param>
 public static T GetApplicationId <T>(this ISession session)
 {
     return(Convert.To <T>(Web.Identity.GetValue(ClaimTypes.ApplicationId)));
 }
Example #4
0
        /// <summary>
        /// 获取当前操作人电子邮件
        /// </summary>
        /// <param name="session">用户会话</param>
        public static string GetEmail(this ISession session)
        {
            var result = Web.Identity.GetValue(JwtClaimTypes.Email);

            return(string.IsNullOrWhiteSpace(result) ? Web.Identity.GetValue(System.Security.Claims.ClaimTypes.Email) : result);
        }
Example #5
0
        /// <summary>
        /// 获取当前操作人手机号
        /// </summary>
        /// <param name="session">用户会话</param>
        public static string GetMobile(this ISession session)
        {
            var result = Web.Identity.GetValue(JwtClaimTypes.PhoneNumber);

            return(string.IsNullOrWhiteSpace(result) ? Web.Identity.GetValue(System.Security.Claims.ClaimTypes.MobilePhone) : result);
        }
Example #6
0
 /// <summary>
 /// 获取当前操作人标识
 /// </summary>
 /// <param name="session">用户会话</param>
 public static T GetUserId <T>(this ISession session)
 {
     return(Convert.To <T>(session.UserId));
 }
Example #7
0
 /// <summary>
 /// 获取当前操作人姓名
 /// </summary>
 /// <param name="session">用户会话</param>
 public static string GetFullName(this ISession session)
 {
     return(Web.Identity.GetValue(ClaimTypes.FullName));
 }
Example #8
0
 /// <summary>
 /// 获取当前操作人标识
 /// </summary>
 /// <param name="session">用户会话</param>
 public static Guid GetUserId(this ISession session)
 {
     return(session.UserId.ToGuid());
 }
Example #9
0
 /// <summary>
 /// 获取当前操作人角色标识列表
 /// </summary>
 /// <param name="session">用户会话</param>
 public static List <T> GetRoleIds <T>(this ISession session)
 {
     return(Convert.ToList <T>(Web.Identity.GetValue(ClaimTypes.RoleIds)));
 }
Example #10
0
 /// <summary>
 /// 获取当前操作人角色标识列表
 /// </summary>
 /// <param name="session">用户会话</param>
 public static List <Guid> GetRoleIds(this ISession session)
 {
     return(session.GetRoleIds <Guid>());
 }
Example #11
0
 /// <summary>
 /// 获取当前租户编码
 /// </summary>
 /// <param name="session">用户会话</param>
 public static string GetTenantCode(this ISession session)
 {
     return(Web.Identity.GetValue(ClaimTypes.TenantCode));
 }
Example #12
0
 /// <summary>
 /// 获取当前租户标识
 /// </summary>
 /// <param name="session">用户会话</param>
 public static Guid GetTenantId(this ISession session)
 {
     return(Web.Identity.GetValue(ClaimTypes.TenantId).ToGuid());
 }