Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop to master #329

Merged
merged 19 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0da5c67
Fix #309: Set develop version to 1.11.0-SNAPSHOT
banterCZ Jul 26, 2024
b7ed76a
Merge pull request #315 from wultra/issues/309-version-1.11.0-SNAPSHOT
banterCZ Jul 26, 2024
bd897bf
Fix #316: JavaDoc warnings (#317)
romanstrobl Aug 19, 2024
51f295c
Bump org.apache.maven.plugins:maven-surefire-plugin from 3.3.1 to 3.4.0
dependabot[bot] Aug 19, 2024
6679983
Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.2 to 3.1.3
dependabot[bot] Aug 19, 2024
d4397c0
Merge pull request #319 from wultra/dependabot/maven/org.apache.maven…
dependabot[bot] Aug 20, 2024
99826af
Merge pull request #318 from wultra/dependabot/maven/org.apache.maven…
dependabot[bot] Aug 20, 2024
74e952a
Fix #320: Support application/x-www-form-urlencode content type
banterCZ Aug 20, 2024
c1eed19
Merge pull request #321 from wultra/issues/320-form-urlencode-content…
banterCZ Aug 20, 2024
fb6f128
Bump spring-boot.version from 3.3.2 to 3.3.3
dependabot[bot] Aug 26, 2024
1164718
Merge pull request #322 from wultra/dependabot/maven/spring-boot.vers…
dependabot[bot] Sep 2, 2024
8891291
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.8.0 to 3.10.0
dependabot[bot] Sep 2, 2024
2d1c8ab
Bump org.apache.maven.plugins:maven-surefire-plugin from 3.4.0 to 3.5.0
dependabot[bot] Sep 2, 2024
315a3d3
Merge pull request #323 from wultra/dependabot/maven/org.apache.maven…
dependabot[bot] Sep 3, 2024
0af8394
Merge pull request #324 from wultra/dependabot/maven/org.apache.maven…
dependabot[bot] Sep 3, 2024
4ea1316
Bump spring-boot.version from 3.3.3 to 3.3.4
dependabot[bot] Sep 23, 2024
556ed3e
Merge pull request #325 from wultra/dependabot/maven/spring-boot.vers…
dependabot[bot] Sep 24, 2024
76c8775
Fix #326: Set release version to 1.11.0
banterCZ Oct 2, 2024
5501c78
Merge pull request #328 from wultra/issues/326-version-1.11.0
banterCZ Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.getlime.core</groupId>
<artifactId>lime-java-core-parent</artifactId>
<version>1.10.0</version>
<version>1.11.0</version>
</parent>

<artifactId>annotations</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion audit-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.getlime.core</groupId>
<artifactId>lime-java-core-parent</artifactId>
<version>1.10.0</version>
<version>1.11.0</version>
</parent>

<artifactId>audit-base</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.getlime.core</groupId>
<artifactId>lime-java-core-parent</artifactId>
<version>1.10.0</version>
<version>1.11.0</version>
</parent>

<artifactId>core-bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion http-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.getlime.core</groupId>
<artifactId>lime-java-core-parent</artifactId>
<version>1.10.0</version>
<version>1.11.0</version>
</parent>

<artifactId>http-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
@Slf4j
public final class UserAgent {

/**
* Device information.
*/
@Data
public static class Device {
private String networkVersion;
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<description>Wultra - Core Java Libraries</description>
<groupId>io.getlime.core</groupId>
<artifactId>lime-java-core-parent</artifactId>
<version>1.10.0</version>
<version>1.11.0</version>
<packaging>pom</packaging>

<inceptionYear>2017</inceptionYear>
Expand Down Expand Up @@ -57,11 +57,11 @@
<maven.compiler.release>${java.version}</maven.compiler.release>

<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.3.1</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.5.0</maven-surefire-plugin.version>
<maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>

<!-- Dependencies -->
<spring-boot.version>3.3.2</spring-boot.version>
<spring-boot.version>3.3.4</spring-boot.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -119,7 +119,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.8.0</version>
<version>3.10.0</version>
<configuration>
<failOnError>false</failOnError>
</configuration>
Expand All @@ -135,7 +135,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
2 changes: 1 addition & 1 deletion rest-client-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.getlime.core</groupId>
<artifactId>lime-java-core-parent</artifactId>
<version>1.10.0</version>
<version>1.11.0</version>
</parent>

<artifactId>rest-client-base</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.net.URISyntaxException;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;

/**
Expand Down Expand Up @@ -839,7 +840,17 @@ private WebClient.RequestBodySpec buildUri(WebClient.RequestBodyUriSpec uriSpec,
private WebClient.RequestHeadersSpec<?> buildRequest(WebClient.RequestBodySpec requestSpec, Object request) {
if (request != null) {
if (request instanceof MultiValueMap) {
return requestSpec.body(BodyInserters.fromMultipartData(((MultiValueMap<String, ?>) request)));
final AtomicReference<MediaType> contentTypeReference = new AtomicReference<>();
requestSpec.headers(httpHeaders -> contentTypeReference.set(httpHeaders.getContentType()));
final MediaType contentType = contentTypeReference.get();

if (MediaType.APPLICATION_FORM_URLENCODED.equals(contentType)) {
return requestSpec.body(BodyInserters.fromFormData((MultiValueMap<String, String>) request));
} else if (MediaType.MULTIPART_FORM_DATA.equals(contentType)) {
return requestSpec.body(BodyInserters.fromMultipartData(((MultiValueMap<String, ?>) request)));
} else {
throw new IllegalArgumentException("Unsupported content type: %s for request type of MultiValueMap".formatted(contentType));
}
} else if (request instanceof Publisher) {
return requestSpec.body(BodyInserters.fromDataBuffers((Publisher<DataBuffer>) request));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import org.springframework.http.client.MultipartBodyBuilder;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.ResourceUtils;
import reactor.core.publisher.Flux;

Expand Down Expand Up @@ -662,6 +664,26 @@ void testPostWithMultipartData() throws RestClientException {
assertEquals(requestData, responseEntity.getBody().getResponseObject().getResponse());
}

@Test
void testPostFormData() throws Exception {
final HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);

final MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.add("grant_type", "authorization_code");
map.add("client_id", "wultra");
map.add("client_secret", "top-secret");

final ResponseEntity<ObjectResponse<TestResponse>> responseEntity =
restClient.post("/form-data-request-response", map, null, headers, new ParameterizedTypeReference<>(){});

assertNotNull(responseEntity);
assertNotNull(responseEntity.getBody());
assertNotNull(responseEntity.getBody().getResponseObject());
assertEquals("OK", responseEntity.getBody().getStatus());
assertEquals("form-data: [authorization_code, wultra, top-secret]", responseEntity.getBody().getResponseObject().getResponse());
}

@Test
void testPostOctetStream() throws Exception {
final byte[] request = {1, 2};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.SecurityFilterChain;
Expand Down Expand Up @@ -53,13 +54,14 @@ private DigestAuthenticationFilter digestAuthenticationFilter() {

@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http.csrf().disable()
return http
.csrf(AbstractHttpConfigurer::disable)
Dismissed Show dismissed Hide dismissed
.exceptionHandling(e -> e.authenticationEntryPoint(authenticationEntryPoint()))
.addFilter(digestAuthenticationFilter())
.authorizeHttpRequests()
.requestMatchers("/private/**").authenticated()
.anyRequest().permitAll()
.and().build();
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/private/**").authenticated()
.anyRequest().permitAll()
).build();
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.net.URI;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;

/**
* Rest controller for tests.
Expand Down Expand Up @@ -85,6 +86,11 @@ public ObjectResponse<TestResponse> testPostWithMultipartRequestAndResponse(@Req
return new ObjectResponse<>(testResponse);
}

@PostMapping(value = "/form-data-request-response", consumes = { MediaType.APPLICATION_FORM_URLENCODED_VALUE })
public ObjectResponse<TestResponse> testPostFormDataRequestAndResponse(@RequestParam("grant_type") final String grantType, @RequestParam("client_id") final String clientId, @RequestParam("client_secret") final String clientSecret) {
return new ObjectResponse<>(new TestResponse("form-data: " + List.of(grantType, clientId, clientSecret)));
}

@PostMapping(value = "/octet-stream", consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public ObjectResponse<TestResponse> testPostOctetStream(@RequestBody byte[] request) {
final TestResponse testResponse = new TestResponse("length: " + request.length);
Expand Down
2 changes: 1 addition & 1 deletion rest-model-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.getlime.core</groupId>
<artifactId>lime-java-core-parent</artifactId>
<version>1.10.0</version>
<version>1.11.0</version>
</parent>

<artifactId>rest-model-base</artifactId>
Expand Down