Rule-based authentication structure and logic