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();
            }
        }
Beispiel #2
0
 public AuthenticationController(DatabaseUserConnector database, JWTService jWTService, UserService userService)
 {
     this.database    = database;
     this.jWTService  = jWTService;
     this.userService = userService;
 }