File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
backend/src/main/java/com/youdemy/security Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -48,16 +48,16 @@ public AuthenticationManager authenticationManagerBean() throws Exception {
48
48
protected void configure (HttpSecurity http ) throws Exception {
49
49
50
50
http .antMatcher ("/api/**" );
51
-
52
- // Other URLs can be accessed without authentication
53
- http .authorizeRequests ().anyRequest ().permitAll ();
54
51
55
52
// URLs that need authentication to access to it
56
53
http .authorizeRequests ().antMatchers (HttpMethod .POST , "/api/courses/**" ).hasAnyRole ("TEACHER" , "ADMIN" );
57
54
http .authorizeRequests ().antMatchers (HttpMethod .DELETE , "/api/courses/**" ).hasAnyRole ("TEACHER" , "ADMIN" );
58
55
59
56
http .authorizeRequests ().antMatchers (HttpMethod .DELETE , "/api/orders/**" ).hasRole ("ADMIN" );
60
57
58
+ // Other URLs can be accessed without authentication
59
+ http .authorizeRequests ().anyRequest ().permitAll ();
60
+
61
61
// Disable CSRF protection (it is difficult to implement in REST APIs)
62
62
http .csrf ().disable ();
63
63
You can’t perform that action at this time.
0 commit comments