diff --git a/generators/java/generators/graalvm/generator.ts b/generators/java/generators/graalvm/generator.ts index bfbc78453524..1a75aad8ab28 100644 --- a/generators/java/generators/graalvm/generator.ts +++ b/generators/java/generators/graalvm/generator.ts @@ -188,7 +188,7 @@ export default class GraalvmGenerator extends BaseApplicationGenerator { nativeBuildToolsVersion: javaDependencies!.nativeBuildTools!, databaseTypeSql, userLanguage: nativeLanguageDefinition.languageTag, - languages: languagesDefinition.map(def => def.languageTag), + languages: languagesDefinition?.map(def => def.languageTag) ?? [nativeLanguageDefinition.languageTag], }), ); }, diff --git a/generators/java/generators/graalvm/templates/gradle/native.gradle.ejs b/generators/java/generators/graalvm/templates/gradle/native.gradle.ejs index 5e286ba13f42..0366799c049e 100644 --- a/generators/java/generators/graalvm/templates/gradle/native.gradle.ejs +++ b/generators/java/generators/graalvm/templates/gradle/native.gradle.ejs @@ -9,7 +9,7 @@ graalvmNative { // vendor = JvmVendorSpec.matching("GraalVM Community") //} buildArgs.add("-Duser.language=<%- nativeLanguageDefinition.languageTag %>") - buildArgs.add("-H:IncludeLocales=<%- languagesDefinition.map(def => def.languageTag).join(',') %>") + buildArgs.add("-H:IncludeLocales=<%- languagesDefinition?.map(def => def.languageTag)?.join(',') ?? nativeLanguageDefinition.languageTag %>") } } binaries.all { diff --git a/generators/spring-boot/templates/src/main/java/_package_/web/rest/LogoutResource_imperative.java.ejs b/generators/spring-boot/templates/src/main/java/_package_/web/rest/LogoutResource_imperative.java.ejs index f5bd33401c9d..98916d5a506a 100644 --- a/generators/spring-boot/templates/src/main/java/_package_/web/rest/LogoutResource_imperative.java.ejs +++ b/generators/spring-boot/templates/src/main/java/_package_/web/rest/LogoutResource_imperative.java.ejs @@ -22,7 +22,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; -import org.springframework.security.oauth2.core.oidc.OidcIdToken; +import org.springframework.security.oauth2.core.oidc.user.OidcUser; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import jakarta.servlet.http.HttpServletRequest; @@ -44,18 +44,18 @@ public class LogoutResource { * {@code POST /api/logout} : logout the current user. * * @param request the {@link HttpServletRequest}. - * @param idToken the ID token. + * @param oidcUser the OIDC user. * @return the {@link ResponseEntity} with status {@code 200 (OK)} and a body with a global logout URL. */ @PostMapping("/api/logout") - public ResponseEntity logout(HttpServletRequest request, @AuthenticationPrincipal(expression = "idToken") OidcIdToken idToken) { + public ResponseEntity logout(HttpServletRequest request, @AuthenticationPrincipal OidcUser oidcUser) { StringBuilder logoutUrl = new StringBuilder(); logoutUrl.append(this.registration.getProviderDetails().getConfigurationMetadata().get("end_session_endpoint").toString()); String originUrl = request.getHeader(HttpHeaders.ORIGIN); - logoutUrl.append("?id_token_hint=").append(idToken.getTokenValue()).append("&post_logout_redirect_uri=").append(originUrl); + logoutUrl.append("?id_token_hint=").append(oidcUser.getIdToken().getTokenValue()).append("&post_logout_redirect_uri=").append(originUrl); request.getSession().invalidate(); return ResponseEntity.ok().body(Map.of("logoutUrl", logoutUrl.toString())); diff --git a/generators/spring-boot/templates/src/main/java/_package_/web/rest/LogoutResource_reactive.java.ejs b/generators/spring-boot/templates/src/main/java/_package_/web/rest/LogoutResource_reactive.java.ejs index ca7b99b7c771..9656d717ba4c 100644 --- a/generators/spring-boot/templates/src/main/java/_package_/web/rest/LogoutResource_reactive.java.ejs +++ b/generators/spring-boot/templates/src/main/java/_package_/web/rest/LogoutResource_reactive.java.ejs @@ -22,6 +22,7 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository; import org.springframework.security.oauth2.core.oidc.OidcIdToken; +import org.springframework.security.oauth2.core.oidc.user.OidcUser; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.WebSession; @@ -43,18 +44,18 @@ public class LogoutResource { /** * {@code POST /api/logout} : logout the current user. * - * @param idToken the ID token. + * @param oidcUser the OIDC user. * @param request a {@link ServerHttpRequest} request. * @param session the current {@link WebSession}. * @return status {@code 200 (OK)} and a body with a global logout URL. */ @PostMapping("/api/logout") public Mono> logout( - @AuthenticationPrincipal(expression = "idToken") OidcIdToken idToken, + @AuthenticationPrincipal OidcUser oidcUser, ServerHttpRequest request, WebSession session ) { - return session.invalidate().then(this.registration.map(oidc -> prepareLogoutUri(request, oidc, idToken))); + return session.invalidate().then(this.registration.map(oidc -> prepareLogoutUri(request, oidc, oidcUser.getIdToken()))); } private Map prepareLogoutUri(ServerHttpRequest request, ClientRegistration clientRegistration, OidcIdToken idToken) { diff --git a/generators/spring-data-relational/generator.ts b/generators/spring-data-relational/generator.ts index 043e0271f5e6..1ebad1b44bb3 100644 --- a/generators/spring-data-relational/generator.ts +++ b/generators/spring-data-relational/generator.ts @@ -226,13 +226,15 @@ export default class SqlGenerator extends BaseApplicationGenerator { publicConstructors: ['org.hibernate.binder.internal.BatchSizeBinder.class'], }); }, + async nativeMavenBuildTool({ application, source }) { + if (!application.buildToolMaven || !application.graalvmSupport) return; + + source.addMavenProperty!({ property: 'spring.h2.console.enabled', value: 'true' }); + }, async nativeGradleBuildTool({ application, source }) { if (!application.buildToolGradle || !application.graalvmSupport) return; - const { reactive, javaManagedProperties, buildToolMaven } = application; - if (buildToolMaven) { - source.addMavenProperty!({ property: 'spring.h2.console.enabled', value: 'true' }); - } + const { reactive, javaManagedProperties } = application; if (!reactive) { source.addGradleDependencyCatalogVersion!({ name: 'hibernate', version: javaManagedProperties!['hibernate.version']! }); source.addGradleDependencyCatalogPlugin!({