Control of users, with data in external server.

Hello I am, implemented a system in which I do not store user data in my database (user, password, etc.) for a group of users and for others I only have the username.

I have a function that validates me if user and password are correct.

How could you change the way that Yii2 performs validation so that users can authenticate without problems?

I appreciate your help.

Authentication in Yii is handled by IndentityInterface so you have to implement it.