Building a model for an authentication validity check