fix token removal, improve system properties, add pretix request warnings

This commit is contained in:
_Bastler 2023-12-15 08:47:54 +01:00
parent 4b819f1d08
commit 1488a3b8b7
4 changed files with 24 additions and 7 deletions

View File

@ -525,11 +525,15 @@ public class PretixManager implements SmartInitializingSingleton {
if (payload != null) {
request.bodyValue(gson.toJson(payload));
}
try {
String jsonString = request.retrieve().bodyToMono(String.class).block();
String jsonString = request.retrieve().bodyToMono(String.class).block();
if (StringUtils.hasText(jsonString)) {
return JsonParser.parseString(jsonString);
if (StringUtils.hasText(jsonString)) {
return JsonParser.parseString(jsonString);
}
} catch (WebClientResponseException e) {
logger.warn("Error response: " + e.getResponseBodyAsString(), e);
throw e;
}
return null;

View File

@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.beust.jcommander.internal.Lists;
import de.bstly.we.businesslogic.PretixManager;
import de.bstly.we.controller.support.EntityResponseStatusException;
import de.bstly.we.model.SystemProperty;
@ -90,6 +92,17 @@ public class SystemController extends BaseController {
return systemPropertyRepository.save(systemProperty);
}
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping("/properties/list")
public List<SystemProperty> createOrUpdateList(@RequestBody List<SystemProperty> systemProperties) {
List<SystemProperty> result = Lists.newArrayList();
for (SystemProperty systemProperty : systemProperties) {
result.add(
systemPropertyRepository.save(systemProperty));
}
return result;
}
/**
* Delete property.
*

View File

@ -260,9 +260,9 @@ public class TokenSessionManager {
for (String token : ((String) sessionAttribute).split(",")) {
if (!token.equals(secret)) {
if (StringUtils.hasLength(tokens)) {
tokens += "," + secret;
tokens += "," + token;
} else {
tokens = secret;
tokens = token;
}
}
}

View File

@ -14,7 +14,7 @@
<java.version>17</java.version>
<querydsl.version>5.0.0</querydsl.version>
<nimbus.version>9.37.3</nimbus.version>
<revision>3.0.2-SNAPSHOT</revision>
<revision>3.0.3-SNAPSHOT</revision>
</properties>
<parent>