Skip to content

Commit 6241e35

Browse files
committed
Try to fix report endpoint
1 parent 33c52e0 commit 6241e35

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Frontend/solarWatch/src/pages/Login.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const Login = () => {
2727

2828
if (response?.jwt) {
2929
localStorage.setItem("jwt", response.jwt);
30+
console.log(localStorage.getItem("jwt"));
3031
setNotification({
3132
type: "success",
3233
message: "You Logged in",

solar-watch/src/main/java/com/codecool/solarwatch/security/WebSecurityConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.codecool.solarwatch.security;
22

3+
import com.codecool.solarwatch.model.Role;
34
import com.codecool.solarwatch.security.jwt.AuthEntryPointJwt;
45
import com.codecool.solarwatch.security.jwt.AuthTokenFilter;
56
import com.codecool.solarwatch.security.jwt.JwtUtils;
@@ -66,6 +67,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
6667
.authorizeHttpRequests(auth ->
6768
auth.requestMatchers("/api/user/**").permitAll()
6869
.requestMatchers("/error").permitAll()
70+
.requestMatchers("/api/report").hasRole("USER")
6971
.anyRequest().authenticated()
7072
);
7173

0 commit comments

Comments
 (0)