diff --git a/lab4-vue-front/public/index.html b/lab4-vue-front/public/index.html index 1cb8e4f..0cb01fe 100644 --- a/lab4-vue-front/public/index.html +++ b/lab4-vue-front/public/index.html @@ -6,10 +6,13 @@ + + LabWork04 - Social Network - + +
diff --git a/lab4-vue-front/src/App.vue b/lab4-vue-front/src/App.vue index 230227f..9b42b79 100644 --- a/lab4-vue-front/src/App.vue +++ b/lab4-vue-front/src/App.vue @@ -1,45 +1,72 @@ diff --git a/lab4-vue-front/src/components/Admin.vue b/lab4-vue-front/src/components/Admin.vue new file mode 100644 index 0000000..4cbdc23 --- /dev/null +++ b/lab4-vue-front/src/components/Admin.vue @@ -0,0 +1,223 @@ + + + + + \ No newline at end of file diff --git a/lab4-vue-front/src/components/Customers.vue b/lab4-vue-front/src/components/Customers.vue index b581ae4..ea4be8f 100644 --- a/lab4-vue-front/src/components/Customers.vue +++ b/lab4-vue-front/src/components/Customers.vue @@ -1,9 +1,6 @@ diff --git a/lab4-vue-front/src/components/Feed.vue b/lab4-vue-front/src/components/Feed.vue new file mode 100644 index 0000000..648a352 --- /dev/null +++ b/lab4-vue-front/src/components/Feed.vue @@ -0,0 +1,324 @@ + + + + + \ No newline at end of file diff --git a/lab4-vue-front/src/components/Login.vue b/lab4-vue-front/src/components/Login.vue new file mode 100644 index 0000000..b7c3820 --- /dev/null +++ b/lab4-vue-front/src/components/Login.vue @@ -0,0 +1,64 @@ + + + + + \ No newline at end of file diff --git a/lab4-vue-front/src/components/Posts.vue b/lab4-vue-front/src/components/Posts.vue deleted file mode 100644 index c71d1e1..0000000 --- a/lab4-vue-front/src/components/Posts.vue +++ /dev/null @@ -1,295 +0,0 @@ - - - - - \ No newline at end of file diff --git a/lab4-vue-front/src/components/Signup.vue b/lab4-vue-front/src/components/Signup.vue new file mode 100644 index 0000000..6c4ec6a --- /dev/null +++ b/lab4-vue-front/src/components/Signup.vue @@ -0,0 +1,69 @@ + + + + + \ No newline at end of file diff --git a/lab4-vue-front/src/main.js b/lab4-vue-front/src/main.js index c7ca24d..63a0924 100644 --- a/lab4-vue-front/src/main.js +++ b/lab4-vue-front/src/main.js @@ -3,20 +3,36 @@ import App from './App' import { createRouter, createWebHistory } from "vue-router" import Customers from './components/Customers' -import Posts from './components/Posts' +import Feed from './components/Feed' +import Login from "@/components/Login.vue"; +import Signup from "@/components/Signup.vue"; +import Admin from "@/components/Admin.vue"; const routes = [ { path: '/customers/:id?', name: "Customers", - component: Customers, - props: true + component: Customers }, { - path: '/posts', - name: "Posts", - component: Posts, - props: true + path: '/feed', + name: "Feed", + component: Feed + }, + { + path: '/login', + name: "Login", + component: Login + }, + { + path: '/signup', + name: "Signup", + component: Signup + }, + { + path: '/admin', + name: "Admin", + component: Admin } ] diff --git a/src/main/java/ru/ulstu/is/labwork/Lab4/security/SecurityConfiguration.java b/src/main/java/ru/ulstu/is/labwork/Lab4/security/SecurityConfiguration.java index f004b66..554cc9a 100644 --- a/src/main/java/ru/ulstu/is/labwork/Lab4/security/SecurityConfiguration.java +++ b/src/main/java/ru/ulstu/is/labwork/Lab4/security/SecurityConfiguration.java @@ -23,6 +23,7 @@ import org.springframework.security.web.authentication.LoginUrlAuthenticationEnt import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; import org.springframework.security.web.util.matcher.RequestMatcher; +import ru.ulstu.is.labwork.WebConfiguration; import java.util.LinkedHashMap; @@ -50,42 +51,44 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { } } - @Override - protected void configure(HttpSecurity http) throws Exception { - http.exceptionHandling().authenticationEntryPoint(delegatingEntryPoint()); - http.headers().frameOptions().sameOrigin().and() - .cors().and() - .csrf().disable() - .authorizeRequests() - .antMatchers(UserSignUp.SIGNUP_URL).permitAll() - .antMatchers(HttpMethod.GET, LOGIN_URL).permitAll() - .anyRequest().authenticated() - .and() - .formLogin() - .loginPage(LOGIN_URL).permitAll() - .and() - .logout().permitAll(); - } - + //mvc java // @Override // protected void configure(HttpSecurity http) throws Exception { -// log.info("Creating security configuration"); -// http.cors() -// .and() +// http.exceptionHandling().authenticationEntryPoint(delegatingEntryPoint()); +// http.headers().frameOptions().sameOrigin().and() +// .cors().and() // .csrf().disable() -// .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) -// .and() // .authorizeRequests() -// .antMatchers("/", SPA_URL_MASK).permitAll() -// .antMatchers(HttpMethod.POST, WebConfiguration.REST_API + "/customer" + CustomerController.URL_LOGIN).permitAll() -// .antMatchers(HttpMethod.POST, WebConfiguration.REST_API + "/customer").permitAll() -// .anyRequest() -// .authenticated() +// .antMatchers(UserSignUp.SIGNUP_URL).permitAll() +// .antMatchers(HttpMethod.GET, LOGIN_URL).permitAll() +// .anyRequest().authenticated() // .and() -// .addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class) -// .anonymous(); +// .formLogin() +// .loginPage(LOGIN_URL).permitAll() +// .and() +// .logout().permitAll(); // } + //jwt vue + @Override + protected void configure(HttpSecurity http) throws Exception { + log.info("Creating security configuration"); + http.cors() + .and() + .csrf().disable() + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .authorizeRequests() + .antMatchers("/", SPA_URL_MASK).permitAll() + .antMatchers(HttpMethod.POST, WebConfiguration.REST_API + "/customer" + CustomerController.URL_LOGIN).permitAll() + .antMatchers(HttpMethod.POST, WebConfiguration.REST_API + "/customer").permitAll() + .anyRequest() + .authenticated() + .and() + .addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class) + .anonymous(); + } + @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(customerService);