V
V
Victor2015-01-04 02:07:48
Java
Victor, 2015-01-04 02:07:48

How to properly implement user authorization on SpringMVC+Hibernate?

You need to implement user authorization. For example, let's take two roles: user and admin.
User'u does not have access to functionality intended for admin'a. For example, some options (both user and admin can view the list of topics on the forum, but only admin can delete and edit other people's posts). I'm interested in how this is implemented in the spring/hibernate stack. I heard about Spring Security, but just now it prohibits some users from accessing the pages of the site (but this is only a special case of what is needed).
Specifically: authorization, prohibition and permission to view certain pages (depending on the rights), and, if possible, cutting down the functionality on the page (also depending on the rights).
I will be very grateful :)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
anyd3v, 2015-01-04
@davinctor

docs.spring.io/spring-security/site/docs/3.0.x/ref...
@PreAuthorize("hasRole('ROLE_USER')") for method
docs.spring.io/spring-security/site/docs/ 3.0.x/ref...
sec:authorize access="hasRole('supervisor')"
sec:authorize url="/admin"
What are you missing?

N
Nikolai Pavlov, 2015-01-04
@gurinderu

It would be best to take a closer look at spring security, you can do anything there.

A
asd111, 2015-01-04
@asd111

Choose Spring Security.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question