Bump Spring Boot to 3.5.9, Spring Cloud to 2025.0.1 and Vaadin to 25.0.2 (#2862)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
<name>hawkBit :: UI</name>
|
<name>hawkBit :: UI</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<vaadin.version>24.9.7</vaadin.version>
|
<vaadin.version>25.0.2</vaadin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import java.util.List;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.vaadin.flow.component.Component;
|
import com.vaadin.flow.component.Component;
|
||||||
|
import com.vaadin.flow.component.HasElement;
|
||||||
import com.vaadin.flow.component.UI;
|
import com.vaadin.flow.component.UI;
|
||||||
import com.vaadin.flow.component.Unit;
|
import com.vaadin.flow.component.Unit;
|
||||||
import com.vaadin.flow.component.applayout.AppLayout;
|
import com.vaadin.flow.component.applayout.AppLayout;
|
||||||
@@ -68,8 +69,8 @@ public class MainLayout extends AppLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterNavigation() {
|
public void showRouterLayoutContent(final HasElement content) {
|
||||||
super.afterNavigation();
|
super.showRouterLayoutContent(content);
|
||||||
viewTitle.setText(
|
viewTitle.setText(
|
||||||
Optional.ofNullable(getContent())
|
Optional.ofNullable(getContent())
|
||||||
.map(c -> c.getClass().getAnnotation(PageTitle.class))
|
.map(c -> c.getClass().getAnnotation(PageTitle.class))
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.springframework.security.authentication.AccountExpiredException;
|
import org.springframework.security.authentication.AccountExpiredException;
|
||||||
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
@@ -42,32 +41,32 @@ class UserDetailsSetter extends OncePerRequestFilter {
|
|||||||
|
|
||||||
@SuppressWarnings("java:S1066") // java:S1066 - readability preferred
|
@SuppressWarnings("java:S1066") // java:S1066 - readability preferred
|
||||||
@Override
|
@Override
|
||||||
protected void doFilterInternal(@NotNull final HttpServletRequest request, @NotNull final HttpServletResponse response,
|
protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain)
|
||||||
@NotNull final FilterChain filterChain)
|
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
final Authentication authentication = securityContextHolderStrategy.getContext().getAuthentication();
|
||||||
Authentication authentication = securityContextHolderStrategy.getContext().getAuthentication();
|
final Authentication newAuthentication;
|
||||||
Authentication newAuthentication;
|
|
||||||
|
|
||||||
if (!(authentication instanceof AnonymousAuthenticationToken) && authentication.isAuthenticated()) {
|
if (!(authentication instanceof AnonymousAuthenticationToken) && authentication.isAuthenticated()) {
|
||||||
Collection<? extends GrantedAuthority> grantedAuthorities = grantedAuthoritiesService.getGrantedAuthorities(authentication);
|
final Collection<? extends GrantedAuthority> grantedAuthorities = grantedAuthoritiesService.getGrantedAuthorities(authentication);
|
||||||
|
|
||||||
if (authentication instanceof OAuth2AuthenticationToken oAuth2AuthenticationToken) {
|
if (authentication instanceof OAuth2AuthenticationToken oAuth2AuthenticationToken) {
|
||||||
newAuthentication = new OAuth2AuthenticationToken(oAuth2AuthenticationToken.getPrincipal(), grantedAuthorities,
|
newAuthentication = new OAuth2AuthenticationToken(
|
||||||
|
oAuth2AuthenticationToken.getPrincipal(), grantedAuthorities,
|
||||||
oAuth2AuthenticationToken.getAuthorizedClientRegistrationId());
|
oAuth2AuthenticationToken.getAuthorizedClientRegistrationId());
|
||||||
if (authentication.getPrincipal() instanceof OidcUser user) {
|
if (authentication.getPrincipal() instanceof OidcUser user) {
|
||||||
// if there is no refresh token and the access token is expired then relogin is required
|
// if there is no refresh token and the access token is expired then re-login is required
|
||||||
if (user.getIdToken().getExpiresAt() != null && Instant.now().isAfter(user.getIdToken().getExpiresAt())) {
|
if (user.getIdToken().getExpiresAt() != null && Instant.now().isAfter(user.getIdToken().getExpiresAt())) {
|
||||||
throw new AccountExpiredException("Token expired");
|
throw new AccountExpiredException("Token expired");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newAuthentication = new UsernamePasswordAuthenticationToken(authentication.getName(), authentication.getCredentials(),
|
newAuthentication = new UsernamePasswordAuthenticationToken(
|
||||||
grantedAuthorities);
|
authentication.getName(), authentication.getCredentials(), grantedAuthorities);
|
||||||
}
|
}
|
||||||
|
|
||||||
securityContextHolderStrategy.getContext().setAuthentication(newAuthentication);
|
securityContextHolderStrategy.getContext().setAuthentication(newAuthentication);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// proceed with the filter chain
|
||||||
filterChain.doFilter(request, response);
|
filterChain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
8
pom.xml
8
pom.xml
@@ -17,7 +17,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.5.8</version>
|
<version>3.5.9</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
@@ -56,9 +56,9 @@
|
|||||||
<java.client.version>17</java.client.version>
|
<java.client.version>17</java.client.version>
|
||||||
|
|
||||||
<!-- must be the same as the parent version -->
|
<!-- must be the same as the parent version -->
|
||||||
<spring.boot.version>3.5.8</spring.boot.version>
|
<spring.boot.version>3.5.9</spring.boot.version>
|
||||||
<spring.cloud.version>2025.0.0</spring.cloud.version>
|
<spring.cloud.version>2025.0.1</spring.cloud.version>
|
||||||
<springdoc-openapi.version>2.8.14</springdoc-openapi.version>
|
<springdoc-openapi.version>2.8.15</springdoc-openapi.version>
|
||||||
|
|
||||||
<!-- Spring boot version overrides (should be reviewed with every Spring boot upgrade) - START -->
|
<!-- Spring boot version overrides (should be reviewed with every Spring boot upgrade) - START -->
|
||||||
<!-- Newer versions needed than defined in the Spring boot -->
|
<!-- Newer versions needed than defined in the Spring boot -->
|
||||||
|
|||||||
Reference in New Issue
Block a user