How to extend WebUser

Hello everyone,

I am Newbie in Yii2, but i have 2+ years experience in Yii 1.x. I just created my first Yii 2 application via composer.

I would like to create 2 type of roles for users. One for frontend application, for normal visitors, and one for backend application for administrator.

In yii 1.x i usually extends the core cWebUser class and i can check the type of logged user in each controller’s AccessControl function. Unfortonetly i have no idea how can i implement this logic in Yii 2, i could not found any usable example.

I read some article about RBAC and i found some admin or user extentions but i would like to write my own authentication logic as in Yii 1.x i did.

Like this one:

Is there someone who has written or extended the WebUser in Yii 2, and can give me some example ?

Thank you for your answers.