Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void configure(HttpSecurity http) throws Exception {
- http
- .authorizeRequests()
- .antMatchers("/api/users/register").permitAll()
- .antMatchers(HttpMethod.GET, "/api/courses/**").authenticated()
- .antMatchers( "/api/courses/**").hasAuthority(User.Role.ADMIN.name())
- .antMatchers(HttpMethod.GET, "/api/lessons/**").authenticated()
- .antMatchers(HttpMethod.PUT, "/api/lessons/**").hasAuthority(User.Role.TEACHER.name())
- .antMatchers("/api/lessons/**").hasAuthority(User.Role.ADMIN.name())
- .antMatchers(HttpMethod.GET,"/api/hometasks/solutions/marks/**").authenticated()
- .antMatchers("/api/hometasks/solutions/marks/**").hasAnyAuthority(User.Role.ADMIN.name(), User.Role.TEACHER.name())
- .antMatchers(HttpMethod.GET, "/api/users/**").authenticated()
- .antMatchers(HttpMethod.PUT, "/api/users/**").authenticated()
- .antMatchers("/api/users/logout", "/api/users/password/change").authenticated()
- .antMatchers( "/api/users/**").hasAuthority(User.Role.ADMIN.name())
- .antMatchers(HttpMethod.GET, "/api/hometasks/solutions/**").authenticated()
- .antMatchers(HttpMethod.POST, "/api/hometasks/solutions/**").hasAnyAuthority(User.Role.STUDENT.name(), User.Role.ADMIN.name())
- .antMatchers("/api/hometasks/solutions").hasAuthority(User.Role.ADMIN.name())
- .antMatchers(HttpMethod.GET, "/api/courses/feedbacks/**").authenticated()
- .antMatchers(HttpMethod.PUT, "/api/courses/feedbacks/**").hasAnyAuthority(User.Role.STUDENT.name(), User.Role.ADMIN.name())
- .antMatchers(HttpMethod.POST, "/api/courses/feedbacks/**").hasAnyAuthority(User.Role.STUDENT.name(), User.Role.ADMIN.name())
- .antMatchers(HttpMethod.DELETE, "/api/courses/feedbacks/**").hasAnyAuthority(User.Role.STUDENT.name(), User.Role.ADMIN.name())
- .antMatchers(HttpMethod.GET, "/api/teachers/**").hasAnyAuthority(User.Role.TEACHER.name(), User.Role.ADMIN.name())
- .antMatchers("/api/**").authenticated()
- .anyRequest().permitAll();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement