public async Task <UserModel> GetCurrentUserAsync(string jwt) { try { DatabaseUserConnector database = new DatabaseUserConnector(); JWTService jWTService = new JWTService(); var token = jWTService.Verify(jwt); UserModel user = await database.GetUser(token.Issuer); if (user == null) { throw new Exception(); } return(user); } catch { throw new Exception(); } }
public AuthenticationController(DatabaseUserConnector database, JWTService jWTService, UserService userService) { this.database = database; this.jWTService = jWTService; this.userService = userService; }