| | |
| | | this.restAccessDeniedHandler = restAccessDeniedHandler; |
| | | } |
| | | |
| | | @Bean |
| | | public SessionFilter sessionFilter() throws Exception { |
| | | SessionFilter jwtTokenFilter = new SessionFilter(authenticationManagerBean()); |
| | | return jwtTokenFilter; |
| | | } |
| | | |
| | | /** |
| | | * @param http http |
| | | * @throws Exception exception |
| | |
| | | .and().authenticationProvider(restAuthenticationProvider) |
| | | .authorizeRequests() |
| | | .antMatchers(securityIgnoreUrls.toArray(ignores)).permitAll() |
| | | .antMatchers("/api/admin/**").hasRole(RoleEnum.ADMIN.getName()) |
| | | .antMatchers("/api/admin/user/update/password").permitAll() |
| | | .antMatchers("/api/admin/**").hasAnyRole(RoleEnum.ADMIN.getName(),RoleEnum.TEACHER.getName()) |
| | | .antMatchers("/api/student/**").hasRole(RoleEnum.STUDENT.getName()) |
| | | .antMatchers("/api/register/**").anonymous() |
| | | .anyRequest().permitAll() |
| | |
| | | .and().rememberMe().key(CookieConfig.getName()).tokenValiditySeconds(CookieConfig.getInterval()).userDetailsService(formDetailsService) |
| | | .and().csrf().disable() |
| | | .cors(); |
| | | http.addFilter(sessionFilter()); |
| | | } |
| | | |
| | | |