Implement before_filter.