예제 #1
0
        private IActionResult ProcessPayload(JwtPayload payload)
        {
            // generate token
            String token = JwtGenerator.GetToken(payload, Config.Authorization.Secret, Config.Authorization.ExpirationShift);

            if (String.IsNullOrWhiteSpace(token))
            {
                LoggerBundle.Warn("JWT token generation failed: empty token");
                return(StatusCode((Int32)HttpStatusCode.InternalServerError));
            }

            return(Ok(new Dictionary <String, String>
            {
                {
                    "token", token
                }
                ,
                {
                    "expires", payload.Exp.ToString(CultureInfo.InvariantCulture)
                }
            }));
        }