From 09861b425c8526d7c1738f9083b24c2880fa7705 Mon Sep 17 00:00:00 2001 From: Safgerd Date: Fri, 16 Jun 2023 16:13:34 +0400 Subject: [PATCH] =?UTF-8?q?LabWork06:=20=D0=BD=D1=83=20=D0=BD=D0=B5=20?= =?UTF-8?q?=D1=82=D0=BE=20=D1=87=D1=82=D0=BE=20=D0=B1=D1=8B=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82,=20=D0=BD=D0=BE,=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab4-vue-front/public/index.html | 5 +- lab4-vue-front/src/App.vue | 77 +++-- lab4-vue-front/src/components/Admin.vue | 223 ++++++++++++ lab4-vue-front/src/components/Customers.vue | 173 +++++----- lab4-vue-front/src/components/Feed.vue | 324 ++++++++++++++++++ lab4-vue-front/src/components/Login.vue | 64 ++++ lab4-vue-front/src/components/Posts.vue | 295 ---------------- lab4-vue-front/src/components/Signup.vue | 69 ++++ lab4-vue-front/src/main.js | 30 +- .../Lab4/security/SecurityConfiguration.java | 61 ++-- 10 files changed, 878 insertions(+), 443 deletions(-) create mode 100644 lab4-vue-front/src/components/Admin.vue create mode 100644 lab4-vue-front/src/components/Feed.vue create mode 100644 lab4-vue-front/src/components/Login.vue delete mode 100644 lab4-vue-front/src/components/Posts.vue create mode 100644 lab4-vue-front/src/components/Signup.vue 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);