private static bool IsCommand(string firstKeyword, ICommand x, AuthenticationOutput authOutput) { if (x.Keyword.ToLower().Equals(firstKeyword, StringComparison.InvariantCultureIgnoreCase)) { var authenticationRequired = x.InheritsFrom <IAuthCommand>(); var isAuthenticated = authOutput != null; if ((authenticationRequired && isAuthenticated) || (!authenticationRequired)) { return(true); } throw new UnauthorizedUserException( "User has not logged in, or token has expired to executed this command: " + firstKeyword); } return(false); }
public void Standard(AuthenticationOutput output) { output.Token = GenerateJwtToken(output.Id); ViewModel = new JsonResult(output); }