コード例 #1
0
        public static string SetAuthenticated(string username, string firstname, string lastname, int status, int time = 60)
        {
            if (string.IsNullOrEmpty(username))
            {
                Authentication._User  = null;
                Authentication._Token = null;
                return(null);
            }

            Authentication._Token = Securities.JWTEncode(
                new Authentication {
                username  = username,
                firstname = firstname,
                lastname  = lastname,
                status    = status,
                exp       = GetNow.AddMinutes(time).ToBinary()
            });

            return(Authentication._Token);
        }
コード例 #2
0
        public static string SetAuthenticated(User custObj, int time = 60 *24 *365)
        {
            if (custObj == null)
            {
                Authentication._User  = null;
                Authentication._Token = null;
                return(null);
            }

            Authentication._Token = Securities.JWTEncode(
                new Authentication
            {
                username = custObj.username,
                Countday = custObj.Count_Expire_day,
                ep_day   = custObj.Expire_dt,
                exp      = GetNow.AddMinutes(time).ToBinary()
            });
            Authentication._User = custObj;

            return(Authentication._Token);
        }
コード例 #3
0
        public static string SetAuthenticated(Users custObj, int time = 60)
        {
            if (custObj == null)
            {
                Authentication._User  = null;
                Authentication._Token = null;
                return(null);
            }

            Authentication._Token = Securities.JWTEncode(
                new Authentication {
                username  = custObj.username,
                firstname = custObj.firstname,
                lastname  = custObj.lastname,
                status    = custObj.user_type_id,
                exp       = GetNow.AddMinutes(time).ToBinary()
            });
            Authentication._User = custObj;

            return(Authentication._Token);
        }