Fix: problème d'authent

This commit is contained in:
guams 2025-05-07 20:12:02 +02:00
parent 8a2ac5be69
commit 4a06b45020
2 changed files with 3 additions and 1 deletions

View File

@ -36,6 +36,7 @@ public class SpringSecurityConfig {
.requestMatchers(HttpMethod.GET, .requestMatchers(HttpMethod.GET,
"/api/authors", "/api/authors",
"/api/authors/{id}", "/api/authors/{id}",
"/api/authors/{id}/avatar",
"/api/authors/{id}/posts", "/api/authors/{id}/posts",
"/api/posts", "/api/posts",
"/api/posts/{id}", "/api/posts/{id}",

View File

@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.Base64;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -76,7 +77,7 @@ public class AuthorController {
@GetMapping("/{id}/avatar") @GetMapping("/{id}/avatar")
public byte[] getProfilePicture(@PathVariable UUID id) { public byte[] getProfilePicture(@PathVariable UUID id) {
Author author = authorService.findById(id).orElseThrow(() -> new NotFoundException("Author not found")); Author author = authorService.findById(id).orElseThrow(() -> new NotFoundException("Author not found"));
return author.getProfilePicture(); return Base64.getEncoder().encode(author.getProfilePicture());
} }
@DeleteMapping("/{id}") @DeleteMapping("/{id}")