예제 #1
0
        /// <summary>
        /// Build refresh token for a user.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static string BuildRefreshToken(this IEmContext context, User user)
        {
            string refreshToken = StaticFunctions.GenerateRefreshToken();

            user.RefreshToken           = refreshToken;
            user.RefreshTokenExpiration = DateTime.Now.AddYears(1);
            context.Set <User>().Update(user);

            return(refreshToken);
        }
예제 #2
0
 /// <summary>
 /// Reset refresh token for a user.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="user"></param>
 public static void ResetRefreshToken(this IEmContext context, User user)
 {
     user.RefreshToken           = null;
     user.RefreshTokenExpiration = null;
     context.Set <User>().Update(user);
 }