backend fixes

This commit is contained in:
Diamantis Tziotzios 2023-10-27 09:54:49 +03:00
parent d983e1e38e
commit e4203a3bb4
3 changed files with 21 additions and 18 deletions

View File

@ -87,11 +87,13 @@ public class SectionEntity implements XmlSerializable<SectionEntity> {
systemFields.appendChild(systemField.toXml(doc));
}
rootElement.appendChild(systemFields);
if (this.descriptionTemplates != null) {
Element descriptionTemplates = doc.createElement("descriptionTemplates");
for (DescriptionTemplateEntity descriptionTemplate : this.descriptionTemplates) {
descriptionTemplates.appendChild(descriptionTemplate.toXml(doc));
}
rootElement.appendChild(descriptionTemplates);
}
temp = this.fields.stream().filter(f -> f.getCategory().equals(DmpBlueprintFieldCategory.Extra)).collect(Collectors.toList());
List<ExtraFieldEntity> extraFieldList = temp.stream().map(x-> (ExtraFieldEntity)x).collect(Collectors.toList());
Element extraFields = doc.createElement("extraFields");

View File

@ -36,19 +36,19 @@ public class DepositConfiguration {
public List<RepositoryDeposit> depositClients() {
List<RepositoryDeposit> clients = new ArrayList<>();
for (DepositProperties.DepositSource source: properties.getSources()) {
ClientRegistration clientRegistration = ClientRegistration
.withRegistrationId(source.getClientId())
.clientId(source.getClientId())
.clientSecret(source.getClientSecret())
.scope(source.getScope())
.issuerUri(source.getIssuerUrl())
.authorizationGrantType(AuthorizationGrantType.JWT_BEARER)
.build();
ReactiveClientRegistrationRepository clientRegistrationRepository = new InMemoryReactiveClientRegistrationRepository(clientRegistration);
ReactiveOAuth2AuthorizedClientService clientService = new InMemoryReactiveOAuth2AuthorizedClientService(clientRegistrationRepository);
AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager authorizedClientManager = new AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager(clientRegistrationRepository, clientService);
ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager);
clients.add(new DepositRepository(WebClient.builder().baseUrl(source.getUrl() + "/api/deposit").filters(exchangeFilterFunctions -> exchangeFilterFunctions.add(oauth)).build()));
// ClientRegistration clientRegistration = ClientRegistration
// .withRegistrationId(source.getClientId())
// .clientId(source.getClientId())
// .clientSecret(source.getClientSecret())
// .scope(source.getScope())
// .issuerUri(source.getIssuerUrl())
// .authorizationGrantType(AuthorizationGrantType.JWT_BEARER)
// .build();
// ReactiveClientRegistrationRepository clientRegistrationRepository = new InMemoryReactiveClientRegistrationRepository(clientRegistration);
// ReactiveOAuth2AuthorizedClientService clientService = new InMemoryReactiveOAuth2AuthorizedClientService(clientRegistrationRepository);
// AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager authorizedClientManager = new AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager(clientRegistrationRepository, clientService);
// ServerOAuth2AuthorizedClientExchangeFilterFunction oauth = new ServerOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager);
// clients.add(new DepositRepository(WebClient.builder().baseUrl(source.getUrl() + "/api/deposit").filters(exchangeFilterFunctions -> exchangeFilterFunctions.add(oauth)).build()));
}
return clients;
}

View File

@ -14,7 +14,8 @@ import java.util.UUID;
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "category")
property = "category",
visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = SystemFieldPersist.class, name = "0"),
@JsonSubTypes.Type(value = ExtraFieldPersist.class, name = "1")