Вот мой WebSecurityConfig:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@RequiredArgsConstructor
public class WebSecurityConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {
private final UserService userService;
private final PasswordEncoder passwordEncoder;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.headers().frameOptions().disable()
.and().authorizeRequests()
.antMatchers("/login", "/register").permitAll()
.anyRequest().authenticated()
.and().formLogin().loginPage("/login").permitAll()
.and().rememberMe()
.and().logout().permitAll();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userService).passwordEncoder(passwordEncoder);
}
}
Я создал модуль внешнего интерфейса с помощью команды vue create frontend
. Итак, у меня есть этот маршрутизатор для моих страниц:
import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home'
import Login from '@/components/Login'
import Registration from '@/components/Registration'
import AdminPage from '@/components/AdminPage'
Vue.use(Router)
export default new Router({
mode: 'history',
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/home',
name: 'Home',
component: Home
},
{
path: '/login',
name: 'Login',
component: Login
},
{
path: '/register',
name: 'Registration',
component: Registration
},
{
path: '/admin',
name: 'AdminPage',
component: AdminPage
}
]
})
Конечно, у меня есть страница входа. Но я не хочу отправлять запрос на вход в Spring, а не в созданный мной контроллер Как добавить перенаправление на мою vue страницу входа из запроса Spring Boot?