Skip to content
Snippets Groups Projects
Commit fc756f0a authored by Kristiane Skogvang Kolshus's avatar Kristiane Skogvang Kolshus
Browse files

Remove token method

parent 9cbc7f1f
No related branches found
No related tags found
1 merge request!52Final changes
Pipeline #270180 passed
...@@ -76,26 +76,9 @@ public class SecurityConfiguration { ...@@ -76,26 +76,9 @@ public class SecurityConfiguration {
return httpSecurity return httpSecurity
.csrf(AbstractHttpConfigurer::disable) .csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(auth -> { .authorizeHttpRequests(auth -> {
auth.requestMatchers( auth.requestMatchers("/api/auth/**",
"/api/auth/",
"/api/quiz/quiz/",
"/api/quiz/",
"/api/quiz/difficulty",
"/api/quiz/category",
"/api/questions/allQuestionsToAQuiz/",
"/v3/api-docs/", "/v3/api-docs/",
"/swagger-ui/").permitAll(); "/swagger-ui/").permitAll();
auth.requestMatchers(
"/api/quiz/delete/",
"/api/quiz/update",
"/api/quiz/create").hasAnyRole("USER", "ADMIN");
auth.requestMatchers(
"/api/questions/delete/",
"/api/questions/update",
"/api/questions/get/").hasAnyRole("USER", "ADMIN");
auth.requestMatchers(
"/api/user/getId/**",
"/api/user/").hasAnyRole("USER", "ADMIN");
auth.anyRequest().authenticated(); auth.anyRequest().authenticated();
}) })
......
...@@ -5,15 +5,15 @@ export const apiClient = axios.create({ ...@@ -5,15 +5,15 @@ export const apiClient = axios.create({
baseURL: 'http://localhost:8080/api', baseURL: 'http://localhost:8080/api',
//TODO: set api URL //TODO: set api URL
}); });
/*
apiClient.interceptors.request.use( apiClient.interceptors.request.use(
(config) => { (config) => {
const token = getToken(); const token = getToken();
if(token) { if(token) {
config.headers['Authorization'] = `Bearer ${token}`; config.headers['Authorization'] = `Bearer ${token}`;
} }else
return config; return config;
}, },
(error) => { (error) => {
return Promise.reject("Problem with token: " + error); //return Promise.reject("Problem with token: " + error);
}); });*/
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment