K
K
Konstantin2021-01-14 10:32:37
Java
Konstantin, 2021-01-14 10:32:37

What is the best way to create an administrator in a Spring Boot project?

Welcome all. I'm making a small RESTfull API tutorial project in the form of an information portal. I wrote the front myself (html + css + js + a little bit of bootstrap). Rest chose because of the increasing popularity, since learning, then learning what is needed at the current time.
In general, I will move on to the essence of the problem: a site is a few pages with articles, general information, pictures, etc. - in short, nothing supernatural, and there is no magic logic. I decided to implement an administrator, because someone should edit these articles, and then I came up against it. I don't understand how to implement this correctly? All I found was about spring security and user roles, but I don't need any users, I just need the site admin. How is it properly implemented? In which direction should I look?
PS Several people advised me not to use spring for this, but to take something simpler, like django or flusk, but I'm learning java, and I would like to master spring.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Orkhan, 2021-01-14
Hasanly @azerphoenix

Hello colleague!
Yes, Spring is more complex than Django. But since it is convenient for you to write on it, then of course you should write backend on it.
And yes, if you do a project in a good way, then you need Spring Security. You need to create an ADMIN role.
Since the project is simple, you can use In-Memory Auth.
Since you are writing REST, you will most likely need to implement jwt auth.
To create a user by default when the application starts, you can implement the CommandLineRunner interface and create users in the run () method and save them in the database.
PS DB is optional.

B
BorLaze, 2021-01-14
@BorLaze

I don't need any users, I only need the site admin

You're wrong. You will have just two users - admin and guest.
with different rights.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question