예제 #1
0
        public JsonResult Jwt()
        {
            var username = HttpContext.Session.GetString("username");
            var fullname = HttpContext.Session.GetString("fullname");

            if (username != null)
            {
                var token = JwtHelper.CreateTinyDriveToken(username, fullname, _scopeUser, _privateKeyFile);
                return(Json(new { token }));
            }
            else
            {
                var result = Json(new { error = "Failed to auth." });
                result.StatusCode = 403;
                return(result);
            }
        }