public IActionResult GetJWT([FromQuery] RequestJWTModel model)
        {
            var token = new JWTModel {
                Token = jwtService.CreateToken(model.Id, model.Username)
            };

            return(Ok(token));
        }
Esempio n. 2
0
        public async Task <IActionResult> Logout([FromBody] JWTModel model)
        {
            var loggedOut = new JWTBlacklist {
                JWT         = model.Token,
                TimeExpired = jwtService.GetTimeExpired(model.Token),
            };
            await dbContext.Blacklist.AddAsync(loggedOut);

            await dbContext.SaveChangesAsync();

            return(Ok());
        }