M
M
montray2018-10-18 16:01:06
Yii
montray, 2018-10-18 16:01:06

Tips for organizing authorization in rest applications on yii2?

Good day.
I would like to hear the opinion of experienced developers on the following issues:

  1. Let's say I have a users api. Should I use the controller of this api for authorization / registration, or should I make an authorization module in addition to the rest modules?
  2. The next question, more about the architecture itself: is it worth separating the user model into <model for database> and <model with identity interface>?

Although the project is small (spa, yii2 + vue), I would like to do everything right from the beginning.
Thank you for your attention. And I apologize if the questions are poorly worded.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Shumov, 2018-10-18
@inoise

Auth0 to help you and rbac on the server

M
Maxim Timofeev, 2018-10-19
@webinar

make in addition to rest-modules also an authorization module

sounds weird. If you have rest, then you need to somehow implement user storage in it. That is, with some of the requests, it will be necessary to send authorization data. I don’t understand what a separate module will give you?
Why and most importantly how? You will store users out of a DB?

G
Georgy Filonenko, 2018-10-19
@holy_oorphen

1. If the project is small, then I see no reason to bother with creating a separate module.
2. I think it should be divided. In the future, it will save you from the problem of littering the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question