upgrade to Spring Boot 4, add webauthn support, some cleanup
This commit is contained in:
-3
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.businesslogic;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.businesslogic;
|
||||
|
||||
/**
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.businesslogic;
|
||||
|
||||
/**
|
||||
|
||||
+4
-7
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -73,7 +70,7 @@ public class ShortenedUrlController extends BaseController {
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
@GetMapping("/{code}")
|
||||
public void getShortenedUrlLink(@PathVariable("code") String code, HttpServletRequest request,
|
||||
public void getShortenedUrlLink(@PathVariable String code, HttpServletRequest request,
|
||||
HttpServletResponse response) throws IOException {
|
||||
ShortenedUrl shortenedUrl = shortenedUrlManager.get(code);
|
||||
|
||||
@@ -114,7 +111,7 @@ public class ShortenedUrlController extends BaseController {
|
||||
* @throws IOException Signals that an I/O exception has occurred.
|
||||
*/
|
||||
@PostMapping("/{code}")
|
||||
public void getProtectedShortenedUrlLink(@PathVariable("code") String code,
|
||||
public void getProtectedShortenedUrlLink(@PathVariable String code,
|
||||
@ModelAttribute("password") String password, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
ShortenedUrl shortenedUrl = shortenedUrlManager.get(code);
|
||||
@@ -193,7 +190,7 @@ public class ShortenedUrlController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
@GetMapping("/model/{code}")
|
||||
public ShortenedUrl getShortenedUrl(@PathVariable("code") String code) {
|
||||
public ShortenedUrl getShortenedUrl(@PathVariable String code) {
|
||||
ShortenedUrl shortenedUrl = shortenedUrlManager.get(code);
|
||||
if (shortenedUrl == null) {
|
||||
throw new EntityResponseStatusException(HttpStatus.NO_CONTENT);
|
||||
@@ -340,7 +337,7 @@ public class ShortenedUrlController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("isAuthenticated()")
|
||||
@DeleteMapping("/{code}")
|
||||
public void deleteShortenedUrl(@PathVariable("code") String code) {
|
||||
public void deleteShortenedUrl(@PathVariable String code) {
|
||||
if (!permissionManager.hasPermission(getCurrentUserId(), ShortenedUrlPermissions.URL_SHORTENER)) {
|
||||
shortenedUrlManager.deleteAll(getCurrentUserId(), true);
|
||||
throw new EntityResponseStatusException(HttpStatus.FORBIDDEN);
|
||||
|
||||
+2
-5
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.controller;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -70,7 +67,7 @@ public class ShortenedUrlManagementController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@DeleteMapping("/{code}")
|
||||
public void deleteShortenedUrl(@PathVariable("code") String code, @RequestParam("quota") Optional<Boolean> quota) {
|
||||
public void deleteShortenedUrl(@PathVariable String code, @RequestParam("quota") Optional<Boolean> quota) {
|
||||
|
||||
ShortenedUrl shortenedUrl = shortenedUrlManager.get(code);
|
||||
if (shortenedUrl == null) {
|
||||
@@ -88,7 +85,7 @@ public class ShortenedUrlManagementController extends BaseController {
|
||||
*/
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN')")
|
||||
@DeleteMapping("/all/{owner}")
|
||||
public void deleteAll(@PathVariable("owner") Long owner, @RequestParam("quota") Optional<Boolean> quota) {
|
||||
public void deleteAll(@PathVariable Long owner, @RequestParam("quota") Optional<Boolean> quota) {
|
||||
shortenedUrlManager.deleteAll(owner, quota.isPresent() && quota.get().booleanValue());
|
||||
}
|
||||
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.controller.model;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.controller.validation;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.model;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
-3
@@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.bstly.we.urlshortener.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
Reference in New Issue
Block a user