Can't this Context.getAuthenticatedUser be null? You might want to make the check here too