private static bool ValidateToken(string token, out string username) { username = null; var simplePrinciple = JwtAuthManager.GetPrincipal(token); var identity = simplePrinciple?.Identity as ClaimsIdentity; if (identity == null) { return(false); } if (!identity.IsAuthenticated) { return(false); } var usernameClaim = identity.FindFirst(ClaimTypes.Name); username = usernameClaim?.Value; if (string.IsNullOrEmpty(username)) { return(false); } /*VALIDA SE O UTILIZADOR EXISTE**/ if (!AuthUser.UserExists(username)) { return(false); } return(true); }