diff --git a/.java-version b/.java-version new file mode 100644 index 00000000..cc88fecd --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +11.0.15 diff --git a/Jenkinsfile b/Jenkinsfile index 83195992..0deeed93 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,21 +3,20 @@ node { stage('checkout') { deleteDir() - } - stage('checkout') { checkout scm } stage('Clean') { - withMaven(jdk: 'java-17', maven: 'maven-3.8.4'){ - sh "mvn clean -T100" + withMaven(jdk: 'java-11', maven: 'maven') { + sh "mvn clean -T100" } } stage('Package') { - withMaven(jdk: 'java-17', maven: 'maven-3.8.4'){ - sh "mvn -Pjib package jib:build -T100" + withMaven(jdk: 'java-11', maven: 'maven') { + sh "mvn -Pjib verify package jib:build" } } stage("Deploy") { - build 'springdoc-openapi-demos-v2-deploy' + build 'springdoc-openapi-demos-deploy' + deleteDir() } } diff --git a/README.md b/README.md index 91667883..bd475503 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,33 @@ -[![Build Status](https://ci-cd.springdoc.org:8443/buildStatus/icon?job=springdoc-demos%2F2.x)](https://ci-cd.springdoc.org:8443/job/springdoc-demos/job/2.x/) +[![Build Status](https://ci-cd.springdoc.org:8443/buildStatus/icon?job=springdoc-openapi-demos%2F2.x)](https://ci-cd.springdoc.org:8443/view/springdoc-openapi-demos/job/springdoc-openapi-demos/job/2.x/) + + + # Spring-boot with OpenAPI Demo applications. -## [Demo Spring Boot 2 Web MVC with OpenAPI 3](http://158.101.191.70:8081/). +## [Demo Spring Boot 2 Web MVC with OpenAPI 3](https://demos1.springdoc.org/demo-spring-boot-2-webmvc). + +## [Demo Spring Boot 2 WebFlux with OpenAPI 3](https://demos1.springdoc.org/demo-spring-boot-2-webflux/swagger-ui.html). + +## [Demo Spring Boot 2 WebFlux with Functional endpoints OpenAPI 3](https://demos1.springdoc.org/demo-spring-boot-2-webflux-functional/swagger-ui.html). + +## [Demo Spring Boot 2 and Spring Hateoas with OpenAPI 3](https://demos1.springdoc.org/demo-spring-hateoas). -## [Demo Spring Boot 2 WebFlux with OpenAPI 3](http://158.101.191.70:8082/). +## [Demo Spring Boot 2 and Spring Cloud Gateway](https://demos1.springdoc.org/demo-microservices/swagger-ui.html). -## [Demo Spring Boot 1 Web MVC with OpenAPI 3](http://158.101.191.70:8083/). +## [Demo Spring Boot 2 and Spring Cloud Function Web MVC](https://demos1.springdoc.org/spring-cloud-function-webmvc). -## [Demo Spring Boot 2 WebFlux with Functional endpoints OpenAPI 3](http://158.101.191.70:8084/swagger-ui.html). +## [Demo Spring Boot 2 and Spring Cloud Function WebFlux](https://demos1.springdoc.org/spring-cloud-function-webflux/swagger-ui.html). -## [Demo Spring Boot 2 and Spring Hateoas with OpenAPI 3](http://158.101.191.70:8085/swagger-ui.html). -![Branching](https://springdoc.org/images/pets.png) +![Branching](https://springdoc.org/img/pets.png) # **Thank you for the support** * Thanks a lot [JetBrains](https://www.jetbrains.com/?from=springdoc-openapi) for supporting springdoc-openapi project. -![JenBrains logo](https://springdoc.org/images/jetbrains.svg) +![JenBrains logo](https://springdoc.org/img/jetbrains.svg) diff --git a/SUPPORT.md b/SUPPORT.md index b49a24da..cf8be9e2 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -13,12 +13,3 @@ it for your site you have two options: 2. Ask your question of the Jekyll community on [talk.jekyllrb.com](https://talk.jekyllrb.com/) - -Notes: - -- https://hub.docker.com/repository/docker/springdocdemos/spring-cloud-function-webmvc/tags?page=1&ordering=last_updated -- https://github.com/springdoc/springdoc-openapi-demos/wiki/springdoc-openapi-2.x-migration-guide -- https://springdoc.org/v2/demos.html -- https://s01.oss.sonatype.org/content/repositories/snapshots/org/springdoc/ -- docker run --rm -p 8080:8081 springdocdemos/springdoc-openapi-spring-boot-2-webmvc: - 3.1.7-SNAPSHOT diff --git a/demo-oauth2/oauth-authorization-server/pom.xml b/demo-oauth2/oauth-authorization-server/pom.xml deleted file mode 100644 index 5ae50b30..00000000 --- a/demo-oauth2/oauth-authorization-server/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - - org.springdoc - demo-oauth2 - 3.1.7-SNAPSHOT - - oauth-authorization-server - - - org.springframework.security - spring-security-oauth2-authorization-server - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-jdbc - - - com.h2database - h2 - - - diff --git a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/DefaultSecurityConfig.java b/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/DefaultSecurityConfig.java deleted file mode 100644 index 8700f362..00000000 --- a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/DefaultSecurityConfig.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.springdoc.demo.auth; - -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.configuration.EnableWebSecurity; -import org.springframework.security.core.userdetails.User; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.provisioning.InMemoryUserDetailsManager; -import org.springframework.security.web.SecurityFilterChain; - -import static org.springframework.security.config.Customizer.withDefaults; - -@EnableWebSecurity -@Configuration(proxyBeanMethods = false) -public class DefaultSecurityConfig { - - @Bean - SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception { - http - .authorizeHttpRequests(authorize -> - authorize.anyRequest().authenticated() - ) - .cors(withDefaults()) - .formLogin(withDefaults()); - return http.build(); - } - - @Bean - UserDetailsService users() { - UserDetails user = User.withDefaultPasswordEncoder() - .username("josh@test.com") - .password("123") - .roles("USER") - .build(); - return new InMemoryUserDetailsManager(user); - } - -} \ No newline at end of file diff --git a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/Jwks.java b/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/Jwks.java deleted file mode 100644 index 7d43e93d..00000000 --- a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/Jwks.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.springdoc.demo.auth; - -import java.security.KeyPair; -import java.security.interfaces.RSAPrivateKey; -import java.security.interfaces.RSAPublicKey; -import java.util.UUID; - -import com.nimbusds.jose.jwk.RSAKey; - -public final class Jwks { - - private Jwks() { - } - - public static RSAKey generateRsa() { - KeyPair keyPair = KeyGeneratorUtils.generateRsaKey(); - RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); - RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); - return new RSAKey.Builder(publicKey) - .privateKey(privateKey) - .keyID(UUID.randomUUID().toString()) - .build(); - } -} \ No newline at end of file diff --git a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/KeyGeneratorUtils.java b/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/KeyGeneratorUtils.java deleted file mode 100644 index e0619266..00000000 --- a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/KeyGeneratorUtils.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.springdoc.demo.auth; - -import java.math.BigInteger; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.spec.ECFieldFp; -import java.security.spec.ECParameterSpec; -import java.security.spec.ECPoint; -import java.security.spec.EllipticCurve; - -final class KeyGeneratorUtils { - - private KeyGeneratorUtils() { - } - - static KeyPair generateRsaKey() { - KeyPair keyPair; - try { - KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); - keyPairGenerator.initialize(2048); - keyPair = keyPairGenerator.generateKeyPair(); - } - catch (Exception ex) { - throw new IllegalStateException(ex); - } - return keyPair; - } - - static KeyPair generateEcKey() { - EllipticCurve ellipticCurve = new EllipticCurve( - new ECFieldFp( - new BigInteger("115792089210356248762697446949407573530086143415290314195533631308867097853951")), - new BigInteger("115792089210356248762697446949407573530086143415290314195533631308867097853948"), - new BigInteger("41058363725152142129326129780047268409114441015993725554835256314039467401291")); - ECPoint ecPoint = new ECPoint( - new BigInteger("48439561293906451759052585252797914202762949526041747995844080717082404635286"), - new BigInteger("36134250956749795798585127919587881956611106672985015071877198253568414405109")); - ECParameterSpec ecParameterSpec = new ECParameterSpec( - ellipticCurve, - ecPoint, - new BigInteger("115792089210356248762697446949407573529996955224135760342422259061068512044369"), - 1); - - KeyPair keyPair; - try { - KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC"); - keyPairGenerator.initialize(ecParameterSpec); - keyPair = keyPairGenerator.generateKeyPair(); - } - catch (Exception ex) { - throw new IllegalStateException(ex); - } - return keyPair; - } -} diff --git a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/SecurityConfig.java b/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/SecurityConfig.java deleted file mode 100644 index a6eee786..00000000 --- a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/SecurityConfig.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.springdoc.demo.auth; - -import java.util.List; -import java.util.UUID; - -import com.nimbusds.jose.jwk.JWKSet; -import com.nimbusds.jose.jwk.RSAKey; -import com.nimbusds.jose.jwk.source.JWKSource; -import com.nimbusds.jose.proc.SecurityContext; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.security.config.Customizer; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer; -import org.springframework.security.oauth2.core.AuthorizationGrantType; -import org.springframework.security.oauth2.core.ClientAuthenticationMethod; -import org.springframework.security.oauth2.core.oidc.OidcScopes; -import org.springframework.security.oauth2.jwt.JwtDecoder; -import org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationConsentService; -import org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationService; -import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationConsentService; -import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService; -import org.springframework.security.oauth2.server.authorization.client.JdbcRegisteredClientRepository; -import org.springframework.security.oauth2.server.authorization.client.RegisteredClient; -import org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository; -import org.springframework.security.oauth2.server.authorization.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration; -import org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer; -import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.CorsConfigurationSource; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; - -import static org.springframework.security.config.Customizer.withDefaults; - - -@Configuration(proxyBeanMethods = false) -public class SecurityConfig { - private static final List ALLOWED_HEADERS = List.of("Access-Control-Allow-Origin", "x-requested-with"); - private static final List ALLOWED_METHODS = List.of("POST"); - private static final List ALLOWED_ALL = List.of("http://127.0.0.1:8081", "http://127.0.0.1:8082", "http://158.101.191.70:8095","http://158.101.191.70:8096"); - - @Bean - CorsConfigurationSource corsConfigurationSource() { - CorsConfiguration configuration = new CorsConfiguration(); - configuration.setAllowedOrigins(ALLOWED_ALL); - configuration.setAllowedMethods(ALLOWED_METHODS); - configuration.setAllowedHeaders(ALLOWED_HEADERS); - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - source.registerCorsConfiguration("/**", configuration); - return source; - } - - @Bean - @Order(Ordered.HIGHEST_PRECEDENCE) - public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http) throws Exception { - OAuth2AuthorizationServerConfiguration.applyDefaultSecurity(http); - http.getConfigurer(OAuth2AuthorizationServerConfigurer.class) - .oidc(Customizer.withDefaults()); - http - .cors(withDefaults()) - .exceptionHandling(exceptions -> - exceptions.authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/login")) - ) - .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt); - return http.build(); - } - - @Bean - public RegisteredClientRepository registeredClientRepository(JdbcTemplate jdbcTemplate) { - RegisteredClient registeredClient = RegisteredClient.withId(UUID.randomUUID().toString()) - .clientId("newClient") - .clientSecret("{noop}newClientSecret") - .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_POST) - .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) - .authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN) - .authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS) - .redirectUri("http://127.0.0.1:8081/resource-server/swagger-ui/oauth2-redirect.html") - .redirectUri("http://127.0.0.1:8082/resource-server/webjars/swagger-ui/oauth2-redirect.html") - .redirectUri("http://158.101.191.70:8095/resource-server/swagger-ui/oauth2-redirect.html") - .redirectUri("http://158.101.191.70:8096/resource-server/webjars/swagger-ui/oauth2-redirect.html") - .scope(OidcScopes.OPENID) - .scope(OidcScopes.PROFILE) - .scope("springdoc.read") - .scope("springdoc.write") - .build(); - - // Save registered client in db as if in-memory - JdbcRegisteredClientRepository registeredClientRepository = new JdbcRegisteredClientRepository(jdbcTemplate); - registeredClientRepository.save(registeredClient); - - return registeredClientRepository; - } - - @Bean - public OAuth2AuthorizationService authorizationService(JdbcTemplate jdbcTemplate, RegisteredClientRepository registeredClientRepository) { - return new JdbcOAuth2AuthorizationService(jdbcTemplate, registeredClientRepository); - } - - @Bean - public OAuth2AuthorizationConsentService authorizationConsentService(JdbcTemplate jdbcTemplate, RegisteredClientRepository registeredClientRepository) { - return new JdbcOAuth2AuthorizationConsentService(jdbcTemplate, registeredClientRepository); - } - - @Bean - public JWKSource jwkSource() { - RSAKey rsaKey = Jwks.generateRsa(); - JWKSet jwkSet = new JWKSet(rsaKey); - return (jwkSelector, securityContext) -> jwkSelector.select(jwkSet); - } - - @Bean - public JwtDecoder jwtDecoder(JWKSource jwkSource) { - return OAuth2AuthorizationServerConfiguration.jwtDecoder(jwkSource); - } - - @Bean - public AuthorizationServerSettings authorizationServerSettings() { - return AuthorizationServerSettings.builder().build(); - } - - @Bean - public EmbeddedDatabase embeddedDatabase() { - return new EmbeddedDatabaseBuilder() - .generateUniqueName(true) - .setType(EmbeddedDatabaseType.H2) - .setScriptEncoding("UTF-8") - .addScript("org/springframework/security/oauth2/server/authorization/oauth2-authorization-schema.sql") - .addScript("org/springframework/security/oauth2/server/authorization/oauth2-authorization-consent-schema.sql") - .addScript("org/springframework/security/oauth2/server/authorization/client/oauth2-registered-client-schema.sql") - .build(); - } - -} \ No newline at end of file diff --git a/demo-oauth2/oauth-authorization-server/src/main/resources/application.yml b/demo-oauth2/oauth-authorization-server/src/main/resources/application.yml deleted file mode 100644 index 95ed6d46..00000000 --- a/demo-oauth2/oauth-authorization-server/src/main/resources/application.yml +++ /dev/null @@ -1,19 +0,0 @@ -spring: - datasource: - username: sa - url: jdbc:h2:./data/keycloak;DB_CLOSE_ON_EXIT=FALSE - hikari: - maximum-pool-size: 25 - minimum-idle: 1 - -server: - forward-headers-strategy: native - port: 8083 - -logging: - level: - root: INFO - org.springframework.web: INFO - org.springframework.security: INFO - org.springframework.security.oauth2: INFO - org.springframework.boot.autoconfigure: INFO \ No newline at end of file diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/resources/application.yml b/demo-oauth2/oauth-resource-server-webflux/src/main/resources/application.yml deleted file mode 100644 index 023cb2db..00000000 --- a/demo-oauth2/oauth-resource-server-webflux/src/main/resources/application.yml +++ /dev/null @@ -1,25 +0,0 @@ -server: - port: 8082 - -####### resource server configuration properties -spring: - webflux: - base-path: /resource-server - jpa: - defer-datasource-initialization: true - security: - oauth2: - resourceserver: - jwt: - issuer-uri: ${OAUTH2_SERVER:http://127.0.0.1:8083} -springdoc: - version: '@springdoc.version@' - api-docs: - version: openapi_3_1 - swagger-ui: - oauth: - clientId: newClient - clientSecret: newClientSecret - oAuthFlow: - authorizationUrl: ${OAUTH2_SERVER:http://127.0.0.1:8083}/oauth2/authorize - tokenUrl: ${OAUTH2_SERVER:http://127.0.0.1:8083}/oauth2/token diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java b/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java deleted file mode 100644 index b43106ba..00000000 --- a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.springdoc.demo.resource.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpMethod; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.web.SecurityFilterChain; - -@Configuration -public class SecurityConfig { - - @Bean - public SecurityFilterChain filterChain1(HttpSecurity http) throws Exception { - http - .authorizeRequests() - .requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll() - .requestMatchers(HttpMethod.GET, "/user/info", "/api/foos/**") - .hasAuthority("SCOPE_springdoc.read") - .requestMatchers(HttpMethod.POST, "/api/foos") - .hasAuthority("SCOPE_springdoc.write") - .anyRequest() - .authenticated() - .and() - .oauth2ResourceServer() - .jwt(); - return http.build(); - } - -} \ No newline at end of file diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/resources/application.yml b/demo-oauth2/oauth-resource-server-webmvc/src/main/resources/application.yml deleted file mode 100644 index b35e35ee..00000000 --- a/demo-oauth2/oauth-resource-server-webmvc/src/main/resources/application.yml +++ /dev/null @@ -1,25 +0,0 @@ -server: - port: 8081 - servlet: - context-path: /resource-server - -####### resource server configuration properties -spring: - jpa: - defer-datasource-initialization: true - security: - oauth2: - resourceserver: - jwt: - issuer-uri: ${OAUTH2_SERVER:http://127.0.0.1:8083} -springdoc: - version: '@springdoc.version@' - api-docs: - version: openapi_3_1 - swagger-ui: - oauth: - clientId: newClient - clientSecret: newClientSecret - oAuthFlow: - authorizationUrl: ${OAUTH2_SERVER:http://127.0.0.1:8083}/oauth2/authorize - tokenUrl: ${OAUTH2_SERVER:http://127.0.0.1:8083}/oauth2/token diff --git a/demo-person-service/src/main/resources/application.properties b/demo-person-service/src/main/resources/application.properties deleted file mode 100644 index 687b5e99..00000000 --- a/demo-person-service/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -springdoc.version=@springdoc.version@ -springdoc.api-docs.version=openapi_3_1 -server.forward-headers-strategy=framework \ No newline at end of file diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/AppNativeConfiguration.java b/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/AppNativeConfiguration.java deleted file mode 100644 index b7f75fbe..00000000 --- a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/AppNativeConfiguration.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.springdoc.demo.app4; - -import java.util.Arrays; - -import org.springdoc.demo.app4.AppNativeConfiguration.AppNativeRuntimeHints; -import org.springdoc.demo.app4.coffee.CoffeeService; -import org.springdoc.demo.app4.employee.EmployeeRepository; - -import org.springframework.aot.hint.MemberCategory; -import org.springframework.aot.hint.RuntimeHints; -import org.springframework.aot.hint.RuntimeHintsRegistrar; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportRuntimeHints; - -/** - * @author bnasslahsen - */ -@Configuration -@ImportRuntimeHints(AppNativeRuntimeHints.class) -public class AppNativeConfiguration { - - static Class[] applicationClasses = { org.springdoc.demo.app4.user.User[].class, - org.springdoc.demo.app4.employee.Employee[].class, - org.springdoc.demo.app4.coffee.Coffee[].class, - org.springdoc.demo.app4.coffee.CoffeeOrder[].class, - EmployeeRepository.class, - CoffeeService.class - }; - - static class AppNativeRuntimeHints implements RuntimeHintsRegistrar { - - @Override - public void registerHints(RuntimeHints hints, ClassLoader classLoader) { - Arrays.stream(applicationClasses).forEach(applicationClass -> - hints.reflection().registerType(applicationClass, - (hint) -> hint.withMembers(MemberCategory.DECLARED_FIELDS, - MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, - MemberCategory.INVOKE_DECLARED_METHODS))); - } - } - -} diff --git a/demo-spring-cloud-function/spring-cloud-function-webmvc/src/main/resources/application.yml b/demo-spring-cloud-function/spring-cloud-function-webmvc/src/main/resources/application.yml deleted file mode 100644 index a773b6ae..00000000 --- a/demo-spring-cloud-function/spring-cloud-function-webmvc/src/main/resources/application.yml +++ /dev/null @@ -1,8 +0,0 @@ -springdoc: - version: '@springdoc.version@' - api-docs: - version: openapi_3_1 - swagger-ui: - use-root-path: true -server: - forward-headers-strategy: framework \ No newline at end of file diff --git a/demo-spring-data-rest/src/main/resources/application.properties b/demo-spring-data-rest/src/main/resources/application.properties deleted file mode 100644 index e06d2bbb..00000000 --- a/demo-spring-data-rest/src/main/resources/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -springdoc.version=@springdoc.version@ -springdoc.swagger-ui.use-root-path=true -server.forward-headers-strategy=framework -springdoc.api-docs.version=openapi_3_1 diff --git a/pom.xml b/pom.xml index 9d475394..8640f595 100644 --- a/pom.xml +++ b/pom.xml @@ -4,23 +4,16 @@ 4.0.0 org.springdoc springdoc-openapi-demos - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT pom Spring-openapi demos Spring-openapi demos https://springdoc.org/ - - org.springframework.boot - spring-boot-starter-parent - 3.2.0 - - - The Apache License, Version 2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt + http://www.apache.org/licenses/LICENSE-2.0.txt @@ -95,16 +88,6 @@ false - - netflix-candidates - Netflix Candidates - - https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates - - - false - - @@ -121,54 +104,61 @@ false + + snapshots-repo + https://s01.oss.sonatype.org/content/repositories/snapshots + + false + + + true + + - demo-book-service - demo-microservices - demo-spring-boot-3-webflux-functional - demo-spring-boot-3-webflux - demo-spring-boot-3-webmvc - demo-oauth2 - demo-person-service - demo-spring-hateoas - demo-spring-data-rest - demo-spring-cloud-function + springdoc-openapi-spring-boot-1 + springdoc-openapi-spring-boot-2-webmvc + springdoc-openapi-spring-boot-2-webflux + springdoc-openapi-spring-boot-2-webflux-functional + springdoc-openapi-book-service + springdoc-openapi-oauth2 + springdoc-openapi-microservices + springdoc-openapi-person-service + springdoc-openapi-hateoas-service + springdoc-openapi-data-rest + springdoc-openapi-spring-cloud-function - 17 + 1.8 @ ${java.version} ${java.version} UTF-8 UTF-8 - 2.4.0 + 2.7.18 + ${spring-boot.version} + + 1.9.1-SNAPSHOT 3.0.1 3.0.1 1.6 2.5.3 1.6.8 - 3.2.0 + 3.1.4 1.4 - openjdk:17-slim - 2023.0.0-SNAPSHOT - 4.0.3 - 1.0.0 + openjdk:8-jre-slim + 2021.0.2 - org.springframework.security - spring-security-oauth2-authorization-server - ${spring-security-oauth2-authorization-server.version} - - - org.springframework.cloud - spring-cloud-netflix-dependencies - ${spring-cloud-netflix.version} + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} pom import @@ -215,14 +205,6 @@ - - org.graalvm.buildtools - native-maven-plugin - - - org.springframework.boot - spring-boot-maven-plugin - @@ -263,12 +245,13 @@ - registry.hub.docker.com/springdocdemos/${project.artifactId}:${project.version} + registry.hub.docker.com/springdocdemos/${project.artifactId} -XshowSettings:vm + -noverify -Dspring.main.lazy-initialization=true -XX:TieredStopAtLevel=1 @@ -299,9 +282,6 @@ maven-javadoc-plugin ${maven-javadoc-plugin.version} - - all,-missing - attach-javadocs diff --git a/demo-book-service/.gitignore b/springdoc-openapi-book-service/.gitignore similarity index 100% rename from demo-book-service/.gitignore rename to springdoc-openapi-book-service/.gitignore diff --git a/demo-book-service/README.md b/springdoc-openapi-book-service/README.md similarity index 100% rename from demo-book-service/README.md rename to springdoc-openapi-book-service/README.md diff --git a/demo-book-service/pom.xml b/springdoc-openapi-book-service/pom.xml similarity index 59% rename from demo-book-service/pom.xml rename to springdoc-openapi-book-service/pom.xml index c09df51d..1be045b3 100644 --- a/demo-book-service/pom.xml +++ b/springdoc-openapi-book-service/pom.xml @@ -6,9 +6,9 @@ org.springdoc springdoc-openapi-demos - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT - demo-book-service + springdoc-openapi-book-service @@ -17,8 +17,19 @@ org.springdoc - springdoc-openapi-starter-webmvc-ui + springdoc-openapi-ui - + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/demo-book-service/src/main/java/org/springdoc/demo/services/book/SpringdocApplication.java b/springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/SpringdocApplication.java similarity index 100% rename from demo-book-service/src/main/java/org/springdoc/demo/services/book/SpringdocApplication.java rename to springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/SpringdocApplication.java diff --git a/demo-book-service/src/main/java/org/springdoc/demo/services/book/controller/BookController.java b/springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/controller/BookController.java similarity index 97% rename from demo-book-service/src/main/java/org/springdoc/demo/services/book/controller/BookController.java rename to springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/controller/BookController.java index d2282afb..243b3f16 100644 --- a/demo-book-service/src/main/java/org/springdoc/demo/services/book/controller/BookController.java +++ b/springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/controller/BookController.java @@ -20,8 +20,9 @@ import java.util.Collection; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + import org.springdoc.demo.services.book.exception.BookNotFoundException; import org.springdoc.demo.services.book.model.Book; import org.springdoc.demo.services.book.repository.BookRepository; diff --git a/demo-book-service/src/main/java/org/springdoc/demo/services/book/exception/BookNotFoundException.java b/springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/exception/BookNotFoundException.java similarity index 100% rename from demo-book-service/src/main/java/org/springdoc/demo/services/book/exception/BookNotFoundException.java rename to springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/exception/BookNotFoundException.java diff --git a/demo-book-service/src/main/java/org/springdoc/demo/services/book/exception/GlobalControllerExceptionHandler.java b/springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/exception/GlobalControllerExceptionHandler.java similarity index 100% rename from demo-book-service/src/main/java/org/springdoc/demo/services/book/exception/GlobalControllerExceptionHandler.java rename to springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/exception/GlobalControllerExceptionHandler.java diff --git a/demo-book-service/src/main/java/org/springdoc/demo/services/book/model/Book.java b/springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/model/Book.java similarity index 92% rename from demo-book-service/src/main/java/org/springdoc/demo/services/book/model/Book.java rename to springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/model/Book.java index 2637c975..6a19d17e 100644 --- a/demo-book-service/src/main/java/org/springdoc/demo/services/book/model/Book.java +++ b/springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/model/Book.java @@ -18,8 +18,8 @@ package org.springdoc.demo.services.book.model; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; public class Book { diff --git a/demo-book-service/src/main/java/org/springdoc/demo/services/book/repository/BookRepository.java b/springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/repository/BookRepository.java similarity index 100% rename from demo-book-service/src/main/java/org/springdoc/demo/services/book/repository/BookRepository.java rename to springdoc-openapi-book-service/src/main/java/org/springdoc/demo/services/book/repository/BookRepository.java diff --git a/springdoc-openapi-book-service/src/main/resources/application.yml b/springdoc-openapi-book-service/src/main/resources/application.yml new file mode 100644 index 00000000..e61edef6 --- /dev/null +++ b/springdoc-openapi-book-service/src/main/resources/application.yml @@ -0,0 +1,4 @@ +springdoc: + version: '@springdoc.version@' + swagger-ui: + use-root-path: true \ No newline at end of file diff --git a/demo-book-service/src/main/resources/logback.xml b/springdoc-openapi-book-service/src/main/resources/logback.xml similarity index 100% rename from demo-book-service/src/main/resources/logback.xml rename to springdoc-openapi-book-service/src/main/resources/logback.xml diff --git a/demo-book-service/src/test/java/org/springdoc/demo/services/book/SwaggerUnitTest.java b/springdoc-openapi-book-service/src/test/java/org/springdoc/demo/services/book/SwaggerUnitTest.java similarity index 100% rename from demo-book-service/src/test/java/org/springdoc/demo/services/book/SwaggerUnitTest.java rename to springdoc-openapi-book-service/src/test/java/org/springdoc/demo/services/book/SwaggerUnitTest.java diff --git a/demo-microservices/.gitignore b/springdoc-openapi-data-rest/.gitignore similarity index 100% rename from demo-microservices/.gitignore rename to springdoc-openapi-data-rest/.gitignore diff --git a/demo-spring-data-rest/pom.xml b/springdoc-openapi-data-rest/pom.xml similarity index 68% rename from demo-spring-data-rest/pom.xml rename to springdoc-openapi-data-rest/pom.xml index e91615b0..62c66dd3 100644 --- a/demo-spring-data-rest/pom.xml +++ b/springdoc-openapi-data-rest/pom.xml @@ -6,9 +6,9 @@ springdoc-openapi-demos org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT - demo-spring-data-rest + springdoc-openapi-data-rest @@ -33,12 +33,23 @@ org.springdoc - springdoc-openapi-starter-webmvc-ui + springdoc-openapi-ui - org.springframework.boot - spring-boot-starter-validation + org.springdoc + springdoc-openapi-data-rest - + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/Account.java b/springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/Account.java similarity index 81% rename from demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/Account.java rename to springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/Account.java index 72f5b070..9d088ada 100644 --- a/demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/Account.java +++ b/springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/Account.java @@ -25,13 +25,13 @@ import java.util.Date; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Temporal; -import jakarta.persistence.TemporalType; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToOne; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; @Entity public class Account { diff --git a/demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/AccountRepository.java b/springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/AccountRepository.java similarity index 100% rename from demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/AccountRepository.java rename to springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/AccountRepository.java diff --git a/demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/Customer.java b/springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/Customer.java similarity index 71% rename from demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/Customer.java rename to springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/Customer.java index f2f37380..9a2192e1 100644 --- a/demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/Customer.java +++ b/springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/Customer.java @@ -1,10 +1,10 @@ package org.springdoc.demo.data.rest; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; /** * @author Oliver Gierke diff --git a/demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/CustomerRepository.java b/springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/CustomerRepository.java similarity index 100% rename from demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/CustomerRepository.java rename to springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/CustomerRepository.java diff --git a/demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/SpringdocApplication.java b/springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/SpringdocApplication.java similarity index 100% rename from demo-spring-data-rest/src/main/java/org/springdoc/demo/data/rest/SpringdocApplication.java rename to springdoc-openapi-data-rest/src/main/java/org/springdoc/demo/data/rest/SpringdocApplication.java diff --git a/springdoc-openapi-data-rest/src/main/resources/application.properties b/springdoc-openapi-data-rest/src/main/resources/application.properties new file mode 100644 index 00000000..6875c6c2 --- /dev/null +++ b/springdoc-openapi-data-rest/src/main/resources/application.properties @@ -0,0 +1,2 @@ +springdoc.version=@springdoc.version@ +springdoc.swagger-ui.use-root-path=true \ No newline at end of file diff --git a/demo-oauth2/.gitignore b/springdoc-openapi-hateoas-service/.gitignore similarity index 100% rename from demo-oauth2/.gitignore rename to springdoc-openapi-hateoas-service/.gitignore diff --git a/demo-spring-hateoas/README.md b/springdoc-openapi-hateoas-service/README.md similarity index 100% rename from demo-spring-hateoas/README.md rename to springdoc-openapi-hateoas-service/README.md diff --git a/demo-spring-hateoas/pom.xml b/springdoc-openapi-hateoas-service/pom.xml similarity index 66% rename from demo-spring-hateoas/pom.xml rename to springdoc-openapi-hateoas-service/pom.xml index da03285f..f6ee00de 100644 --- a/demo-spring-hateoas/pom.xml +++ b/springdoc-openapi-hateoas-service/pom.xml @@ -6,9 +6,9 @@ springdoc-openapi-demos org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT - demo-spring-hateoas + springdoc-openapi-hateoas-service @@ -33,8 +33,23 @@ org.springdoc - springdoc-openapi-starter-webmvc-ui + springdoc-openapi-ui + + + org.springdoc + springdoc-openapi-hateoas - + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/DatabaseLoader.java b/springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/DatabaseLoader.java similarity index 100% rename from demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/DatabaseLoader.java rename to springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/DatabaseLoader.java diff --git a/demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/Employee.java b/springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/Employee.java similarity index 95% rename from demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/Employee.java rename to springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/Employee.java index 9ee0d5c1..2b96cae3 100644 --- a/demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/Employee.java +++ b/springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/Employee.java @@ -17,9 +17,10 @@ */ package org.springdoc.demo.services.hateoas; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.Id; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; + import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/EmployeeController.java b/springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/EmployeeController.java similarity index 100% rename from demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/EmployeeController.java rename to springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/EmployeeController.java diff --git a/demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/EmployeeRepository.java b/springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/EmployeeRepository.java similarity index 100% rename from demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/EmployeeRepository.java rename to springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/EmployeeRepository.java diff --git a/demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/SpringdocApplication.java b/springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/SpringdocApplication.java similarity index 100% rename from demo-spring-hateoas/src/main/java/org/springdoc/demo/services/hateoas/SpringdocApplication.java rename to springdoc-openapi-hateoas-service/src/main/java/org/springdoc/demo/services/hateoas/SpringdocApplication.java diff --git a/demo-spring-hateoas/src/main/resources/application.properties b/springdoc-openapi-hateoas-service/src/main/resources/application.properties similarity index 64% rename from demo-spring-hateoas/src/main/resources/application.properties rename to springdoc-openapi-hateoas-service/src/main/resources/application.properties index a40f156b..f103c694 100644 --- a/demo-spring-hateoas/src/main/resources/application.properties +++ b/springdoc-openapi-hateoas-service/src/main/resources/application.properties @@ -1,7 +1,5 @@ -server.port=8085 spring.hateoas.use-hal-as-default-json-media-type=false springdoc.swagger-ui.operationsSorter=method springdoc.version=@springdoc.version@ springdoc.swagger-ui.use-root-path=true -server.forward-headers-strategy=framework -springdoc.api-docs.version=openapi_3_1 +server.forward-headers-strategy=framework \ No newline at end of file diff --git a/demo-oauth2/oauth-authorization-server/.gitignore b/springdoc-openapi-microservices/.gitignore similarity index 100% rename from demo-oauth2/oauth-authorization-server/.gitignore rename to springdoc-openapi-microservices/.gitignore diff --git a/demo-microservices/README.md b/springdoc-openapi-microservices/README.md similarity index 100% rename from demo-microservices/README.md rename to springdoc-openapi-microservices/README.md diff --git a/demo-microservices/config-service/.gitignore b/springdoc-openapi-microservices/config-service/.gitignore similarity index 100% rename from demo-microservices/config-service/.gitignore rename to springdoc-openapi-microservices/config-service/.gitignore diff --git a/demo-microservices/config-service/pom.xml b/springdoc-openapi-microservices/config-service/pom.xml similarity index 84% rename from demo-microservices/config-service/pom.xml rename to springdoc-openapi-microservices/config-service/pom.xml index a70b6e4b..18e77852 100644 --- a/demo-microservices/config-service/pom.xml +++ b/springdoc-openapi-microservices/config-service/pom.xml @@ -5,8 +5,8 @@ config-service org.springdoc - demo-microservices - 3.1.7-SNAPSHOT + springdoc-openapi-microservices + 3.1.6-SNAPSHOT diff --git a/demo-microservices/config-service/src/main/java/org/springdoc/demo/services/config/ConfigApplication.java b/springdoc-openapi-microservices/config-service/src/main/java/org/springdoc/demo/services/config/ConfigApplication.java similarity index 100% rename from demo-microservices/config-service/src/main/java/org/springdoc/demo/services/config/ConfigApplication.java rename to springdoc-openapi-microservices/config-service/src/main/java/org/springdoc/demo/services/config/ConfigApplication.java diff --git a/demo-microservices/config-service/src/main/resources/application.yml b/springdoc-openapi-microservices/config-service/src/main/resources/application.yml similarity index 100% rename from demo-microservices/config-service/src/main/resources/application.yml rename to springdoc-openapi-microservices/config-service/src/main/resources/application.yml diff --git a/demo-microservices/config-service/src/main/resources/config/department-service.yml b/springdoc-openapi-microservices/config-service/src/main/resources/config/department-service.yml similarity index 77% rename from demo-microservices/config-service/src/main/resources/config/department-service.yml rename to springdoc-openapi-microservices/config-service/src/main/resources/config/department-service.yml index d1d77f03..26117412 100644 --- a/demo-microservices/config-service/src/main/resources/config/department-service.yml +++ b/springdoc-openapi-microservices/config-service/src/main/resources/config/department-service.yml @@ -14,4 +14,7 @@ logging: springdoc: cache: - disabled: true \ No newline at end of file + disabled: true + version: '@springdoc.version@' + api-docs: + version: openapi_3_1 \ No newline at end of file diff --git a/demo-microservices/config-service/src/main/resources/config/discovery-service.yml b/springdoc-openapi-microservices/config-service/src/main/resources/config/discovery-service.yml similarity index 100% rename from demo-microservices/config-service/src/main/resources/config/discovery-service.yml rename to springdoc-openapi-microservices/config-service/src/main/resources/config/discovery-service.yml diff --git a/demo-microservices/config-service/src/main/resources/config/employee-service.yml b/springdoc-openapi-microservices/config-service/src/main/resources/config/employee-service.yml similarity index 82% rename from demo-microservices/config-service/src/main/resources/config/employee-service.yml rename to springdoc-openapi-microservices/config-service/src/main/resources/config/employee-service.yml index 0d4e979c..b7f53db1 100644 --- a/demo-microservices/config-service/src/main/resources/config/employee-service.yml +++ b/springdoc-openapi-microservices/config-service/src/main/resources/config/employee-service.yml @@ -13,5 +13,8 @@ logging: console: "%d{yyyy-MM-dd HH:mm:ss} ${LOG_LEVEL_PATTERN:-%5p} %m%n" springdoc: + version: '@springdoc.version@' + api-docs: + version: openapi_3_1 cache: disabled: true \ No newline at end of file diff --git a/demo-microservices/config-service/src/main/resources/config/gateway-service.yml b/springdoc-openapi-microservices/config-service/src/main/resources/config/gateway-service.yml similarity index 88% rename from demo-microservices/config-service/src/main/resources/config/gateway-service.yml rename to springdoc-openapi-microservices/config-service/src/main/resources/config/gateway-service.yml index c4baa8db..3848484b 100644 --- a/demo-microservices/config-service/src/main/resources/config/gateway-service.yml +++ b/springdoc-openapi-microservices/config-service/src/main/resources/config/gateway-service.yml @@ -48,7 +48,7 @@ spring: - ContextPathRewritePath=/demo-microservices/organization/(?.*), /$\{path} - RewritePath=/organization/(?.*), /$\{path} - id: openapi-proxy - uri: https://demos.springdoc.org + uri: https://demos1.springdoc.org predicates: - Path=/demo-microservices/v3/api-docs/** filters: @@ -62,13 +62,10 @@ spring: springdoc: - swagger-ui: - urls: - - name: employee - url: /v3/api-docs/employee - - name: department - url: /v3/api-docs/department - - name: organization - url: /v3/api-docs/organization cache: - disabled: true \ No newline at end of file + disabled: true + version: '@springdoc.version@' + swagger-ui: + use-root-path: true + api-docs: + version: openapi_3_1 \ No newline at end of file diff --git a/demo-microservices/config-service/src/main/resources/config/organization-service.yml b/springdoc-openapi-microservices/config-service/src/main/resources/config/organization-service.yml similarity index 81% rename from demo-microservices/config-service/src/main/resources/config/organization-service.yml rename to springdoc-openapi-microservices/config-service/src/main/resources/config/organization-service.yml index a65c9002..d57f4bd8 100644 --- a/demo-microservices/config-service/src/main/resources/config/organization-service.yml +++ b/springdoc-openapi-microservices/config-service/src/main/resources/config/organization-service.yml @@ -12,7 +12,10 @@ eureka: logging: pattern: console: "%d{yyyy-MM-dd HH:mm:ss} ${LOG_LEVEL_PATTERN:-%5p} %m%n" - + springdoc: + version: '@springdoc.version@' + api-docs: + version: openapi_3_1 cache: disabled: true \ No newline at end of file diff --git a/demo-microservices/department-service/.gitignore b/springdoc-openapi-microservices/department-service/.gitignore similarity index 100% rename from demo-microservices/department-service/.gitignore rename to springdoc-openapi-microservices/department-service/.gitignore diff --git a/demo-microservices/department-service/pom.xml b/springdoc-openapi-microservices/department-service/pom.xml similarity index 81% rename from demo-microservices/department-service/pom.xml rename to springdoc-openapi-microservices/department-service/pom.xml index 136d1ce4..33c2f420 100644 --- a/demo-microservices/department-service/pom.xml +++ b/springdoc-openapi-microservices/department-service/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.springdoc - demo-microservices - 3.1.7-SNAPSHOT + springdoc-openapi-microservices + 3.1.6-SNAPSHOT department-service @@ -34,9 +34,13 @@ org.springframework.boot spring-boot-starter-actuator + + org.springframework.cloud + spring-cloud-starter-sleuth + org.springdoc - springdoc-openapi-starter-webmvc-api + springdoc-openapi-webmvc-core diff --git a/demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/DepartmentApplication.java b/springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/DepartmentApplication.java similarity index 100% rename from demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/DepartmentApplication.java rename to springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/DepartmentApplication.java diff --git a/demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/client/EmployeeClient.java b/springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/client/EmployeeClient.java similarity index 100% rename from demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/client/EmployeeClient.java rename to springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/client/EmployeeClient.java diff --git a/demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/controller/DepartmentController.java b/springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/controller/DepartmentController.java similarity index 100% rename from demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/controller/DepartmentController.java rename to springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/controller/DepartmentController.java diff --git a/demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/model/Department.java b/springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/model/Department.java similarity index 100% rename from demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/model/Department.java rename to springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/model/Department.java diff --git a/demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/model/Employee.java b/springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/model/Employee.java similarity index 100% rename from demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/model/Employee.java rename to springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/model/Employee.java diff --git a/demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/repository/DepartmentRepository.java b/springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/repository/DepartmentRepository.java similarity index 100% rename from demo-microservices/department-service/src/main/java/org/springdoc/demo/services/department/repository/DepartmentRepository.java rename to springdoc-openapi-microservices/department-service/src/main/java/org/springdoc/demo/services/department/repository/DepartmentRepository.java diff --git a/demo-microservices/department-service/src/main/resources/application.yml b/springdoc-openapi-microservices/department-service/src/main/resources/application.yml similarity index 62% rename from demo-microservices/department-service/src/main/resources/application.yml rename to springdoc-openapi-microservices/department-service/src/main/resources/application.yml index 08ddcce1..42165e0f 100644 --- a/demo-microservices/department-service/src/main/resources/application.yml +++ b/springdoc-openapi-microservices/department-service/src/main/resources/application.yml @@ -3,7 +3,3 @@ spring: name: department-service config: import: "optional:configserver:${CONFIG_SERVER:http://localhost:8088}" -springdoc: - version: '@springdoc.version@' - api-docs: - version: openapi_3_1 diff --git a/demo-microservices/discovery-service/.gitignore b/springdoc-openapi-microservices/discovery-service/.gitignore similarity index 100% rename from demo-microservices/discovery-service/.gitignore rename to springdoc-openapi-microservices/discovery-service/.gitignore diff --git a/demo-microservices/discovery-service/pom.xml b/springdoc-openapi-microservices/discovery-service/pom.xml similarity index 87% rename from demo-microservices/discovery-service/pom.xml rename to springdoc-openapi-microservices/discovery-service/pom.xml index 4ca650de..e2175bb0 100644 --- a/demo-microservices/discovery-service/pom.xml +++ b/springdoc-openapi-microservices/discovery-service/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.springdoc - demo-microservices - 3.1.7-SNAPSHOT + springdoc-openapi-microservices + 3.1.6-SNAPSHOT discovery-service diff --git a/demo-microservices/discovery-service/src/main/java/org/springdoc/demo/services/discovery/DiscoveryApplication.java b/springdoc-openapi-microservices/discovery-service/src/main/java/org/springdoc/demo/services/discovery/DiscoveryApplication.java similarity index 100% rename from demo-microservices/discovery-service/src/main/java/org/springdoc/demo/services/discovery/DiscoveryApplication.java rename to springdoc-openapi-microservices/discovery-service/src/main/java/org/springdoc/demo/services/discovery/DiscoveryApplication.java diff --git a/demo-microservices/discovery-service/src/main/resources/application.yml b/springdoc-openapi-microservices/discovery-service/src/main/resources/application.yml similarity index 100% rename from demo-microservices/discovery-service/src/main/resources/application.yml rename to springdoc-openapi-microservices/discovery-service/src/main/resources/application.yml diff --git a/demo-microservices/employee-service/.gitignore b/springdoc-openapi-microservices/employee-service/.gitignore similarity index 100% rename from demo-microservices/employee-service/.gitignore rename to springdoc-openapi-microservices/employee-service/.gitignore diff --git a/demo-microservices/employee-service/pom.xml b/springdoc-openapi-microservices/employee-service/pom.xml similarity index 77% rename from demo-microservices/employee-service/pom.xml rename to springdoc-openapi-microservices/employee-service/pom.xml index 65afc0f2..82d3c2a4 100644 --- a/demo-microservices/employee-service/pom.xml +++ b/springdoc-openapi-microservices/employee-service/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.springdoc - demo-microservices - 3.1.7-SNAPSHOT + springdoc-openapi-microservices + 3.1.6-SNAPSHOT employee-service @@ -26,9 +26,13 @@ org.springframework.boot spring-boot-starter-actuator + + org.springframework.cloud + spring-cloud-starter-sleuth + org.springdoc - springdoc-openapi-starter-webmvc-api + springdoc-openapi-webmvc-core diff --git a/demo-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/EmployeeApplication.java b/springdoc-openapi-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/EmployeeApplication.java similarity index 100% rename from demo-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/EmployeeApplication.java rename to springdoc-openapi-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/EmployeeApplication.java diff --git a/demo-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/controller/EmployeeController.java b/springdoc-openapi-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/controller/EmployeeController.java similarity index 100% rename from demo-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/controller/EmployeeController.java rename to springdoc-openapi-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/controller/EmployeeController.java diff --git a/demo-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/model/Employee.java b/springdoc-openapi-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/model/Employee.java similarity index 100% rename from demo-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/model/Employee.java rename to springdoc-openapi-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/model/Employee.java diff --git a/demo-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/repository/EmployeeRepository.java b/springdoc-openapi-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/repository/EmployeeRepository.java similarity index 100% rename from demo-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/repository/EmployeeRepository.java rename to springdoc-openapi-microservices/employee-service/src/main/java/org/springdoc/demo/services/employee/repository/EmployeeRepository.java diff --git a/demo-microservices/employee-service/src/main/resources/application.yml b/springdoc-openapi-microservices/employee-service/src/main/resources/application.yml similarity index 57% rename from demo-microservices/employee-service/src/main/resources/application.yml rename to springdoc-openapi-microservices/employee-service/src/main/resources/application.yml index b9bbc90b..6229369c 100644 --- a/demo-microservices/employee-service/src/main/resources/application.yml +++ b/springdoc-openapi-microservices/employee-service/src/main/resources/application.yml @@ -2,8 +2,4 @@ spring: application: name: employee-service config: - import: "optional:configserver:${CONFIG_SERVER:http://localhost:8088}" -springdoc: - version: '@springdoc.version@' - api-docs: - version: openapi_3_1 \ No newline at end of file + import: "optional:configserver:${CONFIG_SERVER:http://localhost:8088}" \ No newline at end of file diff --git a/demo-microservices/gateway-service/.gitignore b/springdoc-openapi-microservices/gateway-service/.gitignore similarity index 100% rename from demo-microservices/gateway-service/.gitignore rename to springdoc-openapi-microservices/gateway-service/.gitignore diff --git a/demo-microservices/gateway-service/pom.xml b/springdoc-openapi-microservices/gateway-service/pom.xml similarity index 75% rename from demo-microservices/gateway-service/pom.xml rename to springdoc-openapi-microservices/gateway-service/pom.xml index b5597e1c..66ee098f 100644 --- a/demo-microservices/gateway-service/pom.xml +++ b/springdoc-openapi-microservices/gateway-service/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.springdoc - demo-microservices - 3.1.7-SNAPSHOT + springdoc-openapi-microservices + 3.1.6-SNAPSHOT gateway-service @@ -22,9 +22,13 @@ org.springframework.cloud spring-cloud-starter-config + + org.springframework.cloud + spring-cloud-starter-sleuth + org.springdoc - springdoc-openapi-starter-webflux-ui + springdoc-openapi-webflux-ui diff --git a/demo-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/ContextPathRewritePathGatewayFilterFactory.java b/springdoc-openapi-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/ContextPathRewritePathGatewayFilterFactory.java similarity index 100% rename from demo-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/ContextPathRewritePathGatewayFilterFactory.java rename to springdoc-openapi-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/ContextPathRewritePathGatewayFilterFactory.java diff --git a/demo-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/GatewayApplication.java b/springdoc-openapi-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/GatewayApplication.java similarity index 63% rename from demo-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/GatewayApplication.java rename to springdoc-openapi-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/GatewayApplication.java index 0f6b3d97..0f233803 100644 --- a/demo-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/GatewayApplication.java +++ b/springdoc-openapi-microservices/gateway-service/src/main/java/org/springdoc/demo/services/gateway/GatewayApplication.java @@ -1,9 +1,11 @@ package org.springdoc.demo.services.gateway; -import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; -import org.springdoc.core.models.GroupedOpenApi; +import org.springdoc.core.AbstractSwaggerUiConfigProperties.SwaggerUrl; +import org.springdoc.core.SwaggerUiConfigParameters; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -13,6 +15,8 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Lazy; +import static org.springdoc.core.Constants.DEFAULT_API_DOCS_URL; + @SpringBootApplication @EnableDiscoveryClient public class GatewayApplication { @@ -23,16 +27,15 @@ public static void main(String[] args) { @Bean @Lazy(false) - public List apis(RouteDefinitionLocator locator) { - List groups = new ArrayList<>(); + public Set apis(RouteDefinitionLocator locator, SwaggerUiConfigParameters swaggerUiConfigParameters) { + Set urls = new HashSet<>(); List definitions = locator.getRouteDefinitions().collectList().block(); - for (RouteDefinition definition : definitions) { - System.out.println("id: " + definition.getId() + " " + definition.getUri().toString()); - } definitions.stream().filter(routeDefinition -> routeDefinition.getId().matches(".*-service")).forEach(routeDefinition -> { String name = routeDefinition.getId().replaceAll("-service", ""); - GroupedOpenApi.builder().pathsToMatch("/" + name + "/**").group(name).build(); + SwaggerUrl swaggerUrl = new SwaggerUrl(name, DEFAULT_API_DOCS_URL+"/" + name, null); + urls.add(swaggerUrl); }); - return groups; + swaggerUiConfigParameters.setUrls(urls); + return urls; } } diff --git a/demo-microservices/gateway-service/src/main/resources/application.yml b/springdoc-openapi-microservices/gateway-service/src/main/resources/application.yml similarity index 53% rename from demo-microservices/gateway-service/src/main/resources/application.yml rename to springdoc-openapi-microservices/gateway-service/src/main/resources/application.yml index 58e25cb2..85e24aba 100644 --- a/demo-microservices/gateway-service/src/main/resources/application.yml +++ b/springdoc-openapi-microservices/gateway-service/src/main/resources/application.yml @@ -3,9 +3,3 @@ spring: name: gateway-service config: import: "optional:configserver:${CONFIG_SERVER:http://localhost:8088}" -springdoc: - version: '@springdoc.version@' - swagger-ui: - use-root-path: true - api-docs: - version: openapi_3_1 \ No newline at end of file diff --git a/demo-microservices/organization-service/.gitignore b/springdoc-openapi-microservices/organization-service/.gitignore similarity index 100% rename from demo-microservices/organization-service/.gitignore rename to springdoc-openapi-microservices/organization-service/.gitignore diff --git a/demo-microservices/organization-service/pom.xml b/springdoc-openapi-microservices/organization-service/pom.xml similarity index 81% rename from demo-microservices/organization-service/pom.xml rename to springdoc-openapi-microservices/organization-service/pom.xml index 9e351fc0..223f5bc3 100644 --- a/demo-microservices/organization-service/pom.xml +++ b/springdoc-openapi-microservices/organization-service/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.springdoc - demo-microservices - 3.1.7-SNAPSHOT + springdoc-openapi-microservices + 3.1.6-SNAPSHOT organization-service @@ -34,9 +34,13 @@ org.springframework.boot spring-boot-starter-actuator + + org.springframework.cloud + spring-cloud-starter-sleuth + org.springdoc - springdoc-openapi-starter-webmvc-api + springdoc-openapi-webmvc-core diff --git a/demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/OrganizationApplication.java b/springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/OrganizationApplication.java similarity index 100% rename from demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/OrganizationApplication.java rename to springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/OrganizationApplication.java diff --git a/demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/client/DepartmentClient.java b/springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/client/DepartmentClient.java similarity index 100% rename from demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/client/DepartmentClient.java rename to springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/client/DepartmentClient.java diff --git a/demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/client/EmployeeClient.java b/springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/client/EmployeeClient.java similarity index 100% rename from demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/client/EmployeeClient.java rename to springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/client/EmployeeClient.java diff --git a/demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/controller/OrganizationController.java b/springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/controller/OrganizationController.java similarity index 100% rename from demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/controller/OrganizationController.java rename to springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/controller/OrganizationController.java diff --git a/demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Department.java b/springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Department.java similarity index 100% rename from demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Department.java rename to springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Department.java diff --git a/demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Employee.java b/springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Employee.java similarity index 100% rename from demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Employee.java rename to springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Employee.java diff --git a/demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Organization.java b/springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Organization.java similarity index 100% rename from demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Organization.java rename to springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/model/Organization.java diff --git a/demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/repository/OrganizationRepository.java b/springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/repository/OrganizationRepository.java similarity index 100% rename from demo-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/repository/OrganizationRepository.java rename to springdoc-openapi-microservices/organization-service/src/main/java/org/springdoc/demo/services/organization/repository/OrganizationRepository.java diff --git a/demo-microservices/organization-service/src/main/resources/application.yml b/springdoc-openapi-microservices/organization-service/src/main/resources/application.yml similarity index 58% rename from demo-microservices/organization-service/src/main/resources/application.yml rename to springdoc-openapi-microservices/organization-service/src/main/resources/application.yml index 90ca8f23..946ad741 100644 --- a/demo-microservices/organization-service/src/main/resources/application.yml +++ b/springdoc-openapi-microservices/organization-service/src/main/resources/application.yml @@ -2,8 +2,4 @@ spring: application: name: organization-service config: - import: "optional:configserver:${CONFIG_SERVER:http://localhost:8088}" -springdoc: - version: '@springdoc.version@' - api-docs: - version: openapi_3_1 \ No newline at end of file + import: "optional:configserver:${CONFIG_SERVER:http://localhost:8088}" \ No newline at end of file diff --git a/demo-microservices/pom.xml b/springdoc-openapi-microservices/pom.xml similarity index 87% rename from demo-microservices/pom.xml rename to springdoc-openapi-microservices/pom.xml index 2cde7b49..478da55f 100644 --- a/demo-microservices/pom.xml +++ b/springdoc-openapi-microservices/pom.xml @@ -5,12 +5,12 @@ springdoc-openapi-demos org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT pom 4.0.0 - demo-microservices + springdoc-openapi-microservices config-service diff --git a/demo-oauth2/oauth-resource-server-webflux/.gitignore b/springdoc-openapi-oauth2/.gitignore similarity index 100% rename from demo-oauth2/oauth-resource-server-webflux/.gitignore rename to springdoc-openapi-oauth2/.gitignore diff --git a/demo-oauth2/README.md b/springdoc-openapi-oauth2/README.md similarity index 62% rename from demo-oauth2/README.md rename to springdoc-openapi-oauth2/README.md index b7010695..cbaf83b6 100644 --- a/demo-oauth2/README.md +++ b/springdoc-openapi-oauth2/README.md @@ -8,18 +8,18 @@ 1. Client Id: newClient 2. Client secret: newClientSecret 3. Redirect Uris: - - http://127.0.0.1:8081/resource-server/swagger-ui/oauth2-redirect.html - - http://127.0.0.1:8082/resource-server/webjars/swagger-ui/oauth2-redirect.html + - http://localhost:8081/resource-server/swagger-ui/oauth2-redirect.html + - http://localhost:8082/resource-server/webjars/swagger-ui/oauth2-redirect.html -3. There is a test user registered in the Authorization Server: - -- josh@test.com / 123 +3. There are two users registered in the Authorization Server: + 1. josh@test.com / 123 + 2. dave@test.com / pass 4. `oauth-resource-server-webmvc` is a Spring Boot WebMVC based RESTFul API, acting as a backend Application - swagger-ui: http://127.0.0.1:8081/resource-server/swagger-ui.html + swagger-ui: http://localhost:8081/resource-server/swagger-ui.html 5. `oauth-resource-server-webflux` is a Spring Boot WebFlux based RESTFul API, acting as a backend Application - swagger-ui: http://127.0.0.1:8082/resource-server/swagger-ui.html + swagger-ui: http://localhost:8082/resource-server/swagger-ui.html diff --git a/demo-oauth2/oauth-resource-server-webmvc/.gitignore b/springdoc-openapi-oauth2/oauth-authorization-server/.gitignore similarity index 100% rename from demo-oauth2/oauth-resource-server-webmvc/.gitignore rename to springdoc-openapi-oauth2/oauth-authorization-server/.gitignore diff --git a/springdoc-openapi-oauth2/oauth-authorization-server/pom.xml b/springdoc-openapi-oauth2/oauth-authorization-server/pom.xml new file mode 100644 index 00000000..a2d25ebe --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-authorization-server/pom.xml @@ -0,0 +1,40 @@ + + 4.0.0 + + org.springdoc + springdoc-openapi-oauth2 + 3.1.6-SNAPSHOT + + oauth-authorization-server + + + + + com.github.thomasdarimont.embedded-spring-boot-keycloak-server + + embedded-keycloak-server-spring-boot-parent + 5.0.2 + pom + import + + + + + + + com.github.thomasdarimont.embedded-spring-boot-keycloak-server + + embedded-keycloak-server-spring-boot-starter + 5.0.2 + + + + + + jitpack.io + https://jitpack.io + + + diff --git a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/AuthorizationServerApp.java b/springdoc-openapi-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/AuthorizationServerApp.java similarity index 55% rename from demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/AuthorizationServerApp.java rename to springdoc-openapi-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/AuthorizationServerApp.java index 3a66d8ee..0244247a 100644 --- a/demo-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/AuthorizationServerApp.java +++ b/springdoc-openapi-oauth2/oauth-authorization-server/src/main/java/org/springdoc/demo/auth/AuthorizationServerApp.java @@ -2,11 +2,13 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; -@SpringBootApplication +@SpringBootApplication(exclude = LiquibaseAutoConfiguration.class) public class AuthorizationServerApp { - public static void main(String[] args) { + public static void main(String[] args) throws Exception { SpringApplication.run(AuthorizationServerApp.class, args); } + } diff --git a/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/application.yml b/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/application.yml new file mode 100644 index 00000000..a3842568 --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/application.yml @@ -0,0 +1,29 @@ +spring: + datasource: + username: sa + url: jdbc:h2:./data/keycloak;DB_CLOSE_ON_EXIT=FALSE + hikari: + maximum-pool-size: 25 + minimum-idle: 1 + +server: + forward-headers-strategy: native + port: 8083 + +logging: + level: + org.jgroups: INFO + org.infinispan: INFO + org.keycloak: INFO + org.keycloak.services.managers.DefaultBruteForceProtector: DEBUG + org.keycloak.services.scheduled.ClusterAwareScheduledTaskRunner: DEBUG + org.keycloak.services.managers.UserSessionManager: DEBUG + org.keycloak.timer.basic: DEBUG + +keycloak: + custom: + server: + keycloak-path: "/auth" + migration: + importProvider: singleFile + importLocation: "file:springdoc-realm.json" diff --git a/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/banner.txt b/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/banner.txt new file mode 100644 index 00000000..d4e8ef50 --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/banner.txt @@ -0,0 +1,9 @@ + _ __ _ _ __ __ __ + | |/ / ___ _ _ ___ | | ___ __ _ | | __ \ \ \ \ \ \ + | ' / / _ \ | | | | / __| | | / _ \ / _` | | |/ / \ \ \ \ \ \ + | . \ | __/ | |_| | | (__ | | | (_) | | (_| | | < / / / / / / + |_|\_\ \___| \__, | \___| |_| \___/ \__,_| |_|\_\ /_/ /_/ /_/ + |___/ + +Spring Boot Version: ${spring-boot.formatted-version} +Keycloak Version: (v@keycloak.version@) \ No newline at end of file diff --git a/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/springdoc-realm.json b/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/springdoc-realm.json new file mode 100644 index 00000000..89be715a --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-authorization-server/src/main/resources/springdoc-realm.json @@ -0,0 +1,2006 @@ +{ + "id": "springdoc", + "realm": "springdoc", + "notBefore": 0, + "revokeRefreshToken": false, + "refreshTokenMaxReuse": 0, + "accessTokenLifespan": 300, + "accessTokenLifespanForImplicitFlow": 900, + "ssoSessionIdleTimeout": 1800, + "ssoSessionMaxLifespan": 36000, + "ssoSessionIdleTimeoutRememberMe": 0, + "ssoSessionMaxLifespanRememberMe": 0, + "offlineSessionIdleTimeout": 2592000, + "offlineSessionMaxLifespanEnabled": false, + "offlineSessionMaxLifespan": 5184000, + "accessCodeLifespan": 60, + "accessCodeLifespanUserAction": 300, + "accessCodeLifespanLogin": 1800, + "actionTokenGeneratedByAdminLifespan": 43200, + "actionTokenGeneratedByUserLifespan": 300, + "enabled": true, + "sslRequired": "external", + "registrationAllowed": false, + "registrationEmailAsUsername": false, + "rememberMe": false, + "verifyEmail": false, + "loginWithEmailAllowed": true, + "duplicateEmailsAllowed": false, + "resetPasswordAllowed": false, + "editUsernameAllowed": false, + "bruteForceProtected": false, + "permanentLockout": false, + "maxFailureWaitSeconds": 900, + "minimumQuickLoginWaitSeconds": 60, + "waitIncrementSeconds": 60, + "quickLoginCheckMilliSeconds": 1000, + "maxDeltaTimeSeconds": 43200, + "failureFactor": 30, + "roles": { + "realm": [ + { + "id": "3b6109f5-6e5a-4578-83c3-791ec3e2bf9e", + "name": "offline_access", + "description": "${role_offline-access}", + "composite": false, + "clientRole": false, + "containerId": "springdoc", + "attributes": {} + }, + { + "id": "0dd6a8c7-d669-4941-9ea1-521980e9c53f", + "name": "uma_authorization", + "description": "${role_uma_authorization}", + "composite": false, + "clientRole": false, + "containerId": "springdoc", + "attributes": {} + }, + { + "id": "ca962095-7f9b-49e2-a190-e391a0d4b704", + "name": "user", + "composite": false, + "clientRole": false, + "containerId": "springdoc", + "attributes": {} + } + ], + "client": { + "newClient": [], + "realm-management": [ + { + "id": "5d00243f-ceec-4b0c-995e-d86d5b8a0ae6", + "name": "view-clients", + "description": "${role_view-clients}", + "composite": true, + "composites": { + "client": { + "realm-management": [ + "query-clients" + ] + } + }, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "941612de-bd85-47a5-8dfa-37c270dde28c", + "name": "view-authorization", + "description": "${role_view-authorization}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "5ea9810d-63cc-4277-9b32-ba8a3d3c6091", + "name": "manage-realm", + "description": "${role_manage-realm}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "8b7b0dd8-350b-473e-b8cd-8acad34f1358", + "name": "query-clients", + "description": "${role_query-clients}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "0f8e5ee8-b014-4b7c-9b69-50f46abcba5f", + "name": "query-groups", + "description": "${role_query-groups}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "911b1489-9383-4734-b134-bf49bf992ce9", + "name": "manage-clients", + "description": "${role_manage-clients}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "5d48274c-bd6b-4c26-ad54-f1a2254beac0", + "name": "view-realm", + "description": "${role_view-realm}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "3ea43b64-316f-4693-8346-9ee78b24adaf", + "name": "manage-identity-providers", + "description": "${role_manage-identity-providers}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "49735614-96ec-49b2-98fe-3af9bcd1a33a", + "name": "create-client", + "description": "${role_create-client}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "e8f8c3cc-0ff1-4f72-a271-db6821a3cdb6", + "name": "manage-users", + "description": "${role_manage-users}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "387418b1-4f80-4b00-b9dd-805ca041f805", + "name": "view-identity-providers", + "description": "${role_view-identity-providers}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "427c27d4-521a-464b-a0df-16d7f537e8d5", + "name": "realm-admin", + "description": "${role_realm-admin}", + "composite": true, + "composites": { + "client": { + "realm-management": [ + "view-clients", + "view-authorization", + "query-groups", + "manage-realm", + "query-clients", + "manage-clients", + "view-realm", + "manage-identity-providers", + "create-client", + "manage-users", + "view-identity-providers", + "query-users", + "query-realms", + "view-users", + "impersonation", + "manage-authorization", + "manage-events", + "view-events" + ] + } + }, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "a574cf01-03e4-4573-ab9e-276d13a1ce8d", + "name": "query-users", + "description": "${role_query-users}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "c3a253a8-a1b6-4d38-9677-f728f32482ad", + "name": "query-realms", + "description": "${role_query-realms}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "f3cb93da-273e-419a-b2f4-93f09896abcf", + "name": "view-users", + "description": "${role_view-users}", + "composite": true, + "composites": { + "client": { + "realm-management": [ + "query-users", + "query-groups" + ] + } + }, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "6eedf2b7-50ef-4495-a89b-54aef751b7fa", + "name": "manage-authorization", + "description": "${role_manage-authorization}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "0332e99b-3dfc-4193-9e13-5728f8f3e6d6", + "name": "impersonation", + "description": "${role_impersonation}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "b690cb9c-0f4a-4be5-ade0-b40443d8149d", + "name": "view-events", + "description": "${role_view-events}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + }, + { + "id": "aac3def5-f193-4a6c-9065-1667a0746a8a", + "name": "manage-events", + "description": "${role_manage-events}", + "composite": false, + "clientRole": true, + "containerId": "6a4bfbd0-576d-4778-af56-56f876647355", + "attributes": {} + } + ], + "security-admin-console": [], + "admin-cli": [], + "broker": [ + { + "id": "397b5703-4c81-48fd-a24c-a7e8177ef657", + "name": "read-token", + "description": "${role_read-token}", + "composite": false, + "clientRole": true, + "containerId": "4b9609f0-48d1-4e71-9381-2ecec08616f9", + "attributes": {} + } + ], + "account": [ + { + "id": "8daa8096-d14e-4d1c-ad1f-83f822016aa1", + "name": "manage-account", + "description": "${role_manage-account}", + "composite": true, + "composites": { + "client": { + "account": [ + "manage-account-links" + ] + } + }, + "clientRole": true, + "containerId": "12eebf0b-a3eb-49f8-9ecf-173cf8a00145", + "attributes": {} + }, + { + "id": "948269c7-a69c-4c82-a7f3-88868713dfd9", + "name": "manage-account-links", + "description": "${role_manage-account-links}", + "composite": false, + "clientRole": true, + "containerId": "12eebf0b-a3eb-49f8-9ecf-173cf8a00145", + "attributes": {} + }, + { + "id": "aed18201-2433-4998-8fa3-0979b0b31c10", + "name": "view-profile", + "description": "${role_view-profile}", + "composite": false, + "clientRole": true, + "containerId": "12eebf0b-a3eb-49f8-9ecf-173cf8a00145", + "attributes": {} + } + ] + } + }, + "groups": [], + "defaultRoles": [ + "uma_authorization", + "offline_access" + ], + "requiredCredentials": [ + "password" + ], + "otpPolicyType": "totp", + "otpPolicyAlgorithm": "HmacSHA1", + "otpPolicyInitialCounter": 0, + "otpPolicyDigits": 6, + "otpPolicyLookAheadWindow": 1, + "otpPolicyPeriod": 30, + "otpSupportedApplications": [ + "FreeOTP", + "Google Authenticator" + ], + "webAuthnPolicyRpEntityName": "keycloak", + "webAuthnPolicySignatureAlgorithms": [ + "ES256" + ], + "webAuthnPolicyRpId": "", + "webAuthnPolicyAttestationConveyancePreference": "not specified", + "webAuthnPolicyAuthenticatorAttachment": "not specified", + "webAuthnPolicyRequireResidentKey": "not specified", + "webAuthnPolicyUserVerificationRequirement": "not specified", + "webAuthnPolicyCreateTimeout": 0, + "webAuthnPolicyAvoidSameAuthenticatorRegister": false, + "webAuthnPolicyAcceptableAaguids": [], + "users": [ + { + "id": "a5461470-33eb-4b2d-82d4-b0484e96ad7f", + "createdTimestamp": 1574174706812, + "username": "josh@test.com", + "enabled": true, + "totp": false, + "emailVerified": false, + "credentials": [ + { + "id": "024b62f1-3af0-49fc-a15f-e843b72e00df", + "type": "password", + "createdDate": 1574174719522, + "secretData": "{\"value\":\"tfHk9estQfa27osLCY2QelpkL6Sm6rPS+iQ33ytPSD4p10Fk7ophI7ChERAnzDjVSmvdsZAttsg2Yr+8F4Gzfw==\",\"salt\":\"goh99WgI7T1ZuGdrKzNAeQ==\"}", + "credentialData": "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\"}" + } + ], + "disableableCredentialTypes": [], + "requiredActions": [], + "realmRoles": [ + "offline_access", + "uma_authorization" + ], + "clientRoles": { + "account": [ + "manage-account", + "view-profile" + ] + }, + "notBefore": 0, + "groups": [] + }, + { + "id": "22a4d9fe-194c-4c6e-841a-8a55b402459f", + "createdTimestamp": 1580237252522, + "username": "dave@test.com", + "enabled": true, + "totp": false, + "emailVerified": false, + "credentials": [ + { + "id": "73c8d1ca-d548-4e1a-a82d-2c1d0d3ee017", + "type": "password", + "createdDate": 1580237291489, + "secretData": "{\"value\":\"fea4QiAzqmOctQGtJrKvoPRIUKLdQ5UKFIEPEQ7PYjTjxvucDZVk8yzXNfsDHvgpZ2rWiwsACgvsymdHnmru9w==\",\"salt\":\"nu5yJh98jz8cGLnLx36uvg==\"}", + "credentialData": "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\"}" + } + ], + "disableableCredentialTypes": [], + "requiredActions": [], + "realmRoles": [ + "offline_access", + "uma_authorization" + ], + "clientRoles": { + "account": [ + "manage-account", + "view-profile" + ] + }, + "notBefore": 0, + "groups": [] + } + ], + "scopeMappings": [ + { + "clientScope": "offline_access", + "roles": [ + "offline_access" + ] + } + ], + "clients": [ + { + "id": "12eebf0b-a3eb-49f8-9ecf-173cf8a00145", + "clientId": "account", + "name": "${client_account}", + "rootUrl": "${authBaseUrl}", + "baseUrl": "/realms/springdoc/account/", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "defaultRoles": [ + "manage-account", + "view-profile" + ], + "redirectUris": [ + "/realms/springdoc/account/*" + ], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "defaultClientScopes": [ + "web-origins", + "role_list", + "roles", + "profile", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "13d76feb-d762-4409-bb84-7a75bc395a61", + "clientId": "admin-cli", + "name": "${client_admin-cli}", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": [], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": false, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": false, + "publicClient": true, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "defaultClientScopes": [ + "web-origins", + "role_list", + "roles", + "profile", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "4b9609f0-48d1-4e71-9381-2ecec08616f9", + "clientId": "broker", + "name": "${client_broker}", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": [], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "defaultClientScopes": [ + "web-origins", + "role_list", + "roles", + "profile", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "b88ce206-63d6-43b6-87c9-ea09d8c02f32", + "clientId": "newClient", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "newClientSecret", + "redirectUris": [ + "http://localhost:8082/new-client/login/oauth2/code/custom", + "http://localhost:8089/", + "http://localhost:8081/resource-server/swagger-ui/oauth2-redirect.html", + "http://localhost:8082/resource-server/webjars/swagger-ui/oauth2-redirect.html", + "http://158.101.191.70:8095/resource-server/swagger-ui/oauth2-redirect.html", + "http://158.101.191.70:8096/resource-server/webjars/swagger-ui/oauth2-redirect.html", + "http://localhost:8089/auth/redirect/" + ], + "webOrigins": [ + "+" + ], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": true, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": { + "saml.assertion.signature": "false", + "saml.force.post.binding": "false", + "saml.multivalued.roles": "false", + "saml.encrypt": "false", + "saml.server.signature": "false", + "saml.server.signature.keyinfo.ext": "false", + "exclude.session.state.from.auth.response": "false", + "saml_force_name_id_format": "false", + "saml.client.signature": "false", + "tls.client.certificate.bound.access.tokens": "false", + "saml.authnstatement": "false", + "display.on.consent.screen": "false", + "saml.onetimeuse.condition": "false" + }, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": true, + "nodeReRegistrationTimeout": -1, + "defaultClientScopes": [ + "role_list", + "profile" + ], + "optionalClientScopes": [ + "web-origins", + "address", + "read", + "phone", + "roles", + "offline_access", + "microprofile-jwt", + "write", + "email" + ] + }, + { + "id": "6a4bfbd0-576d-4778-af56-56f876647355", + "clientId": "realm-management", + "name": "${client_realm-management}", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": [], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": true, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "defaultClientScopes": [ + "web-origins", + "role_list", + "roles", + "profile", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + }, + { + "id": "8e358d2f-b085-4243-8e6e-c175431e5eeb", + "clientId": "security-admin-console", + "name": "${client_security-admin-console}", + "rootUrl": "${authAdminUrl}", + "baseUrl": "/admin/springdoc/console/", + "surrogateAuthRequired": false, + "enabled": true, + "clientAuthenticatorType": "client-secret", + "secret": "**********", + "redirectUris": [ + "/admin/springdoc/console/*" + ], + "webOrigins": [ + "+" + ], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": true, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": {}, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "protocolMappers": [ + { + "id": "9cfca9ee-493d-4b5e-8170-2d364149de59", + "name": "locale", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "locale", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "locale", + "jsonType.label": "String" + } + } + ], + "defaultClientScopes": [ + "web-origins", + "role_list", + "roles", + "profile", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + } + ], + "clientScopes": [ + { + "id": "77c7e29d-1a22-4419-bbfb-4a62bb033449", + "name": "address", + "description": "OpenID Connect built-in scope: address", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true", + "consent.screen.text": "${addressScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "94e1879d-b49e-4178-96e0-bf8d7f32c160", + "name": "address", + "protocol": "openid-connect", + "protocolMapper": "oidc-address-mapper", + "consentRequired": false, + "config": { + "user.attribute.formatted": "formatted", + "user.attribute.country": "country", + "user.attribute.postal_code": "postal_code", + "userinfo.token.claim": "true", + "user.attribute.street": "street", + "id.token.claim": "true", + "user.attribute.region": "region", + "access.token.claim": "true", + "user.attribute.locality": "locality" + } + } + ] + }, + { + "id": "b3526ac1-10e2-4344-8621-9c5a0853e97a", + "name": "email", + "description": "OpenID Connect built-in scope: email", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true", + "consent.screen.text": "${emailScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "d30270dc-baa6-455a-8ff6-ddccf8a78d86", + "name": "email verified", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "emailVerified", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "email_verified", + "jsonType.label": "boolean" + } + }, + { + "id": "f5b1684d-e479-4134-8578-457fa64717da", + "name": "email", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "email", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "email", + "jsonType.label": "String" + } + } + ] + }, + { + "id": "c658ae14-e96a-4745-b21b-2ed5c4c63f5f", + "name": "microprofile-jwt", + "description": "Microprofile - JWT built-in scope", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "false" + }, + "protocolMappers": [ + { + "id": "959521bc-5ffd-465b-95f2-5b0c20d1909c", + "name": "upn", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "username", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "upn", + "jsonType.label": "String" + } + }, + { + "id": "07b8550c-b298-4cce-9ffb-900182575b76", + "name": "groups", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-realm-role-mapper", + "consentRequired": false, + "config": { + "multivalued": "true", + "userinfo.token.claim": "true", + "user.attribute": "foo", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "groups", + "jsonType.label": "String" + } + } + ] + }, + { + "id": "569b3d44-4ecd-4768-a58c-70ff38f4b4fe", + "name": "offline_access", + "description": "OpenID Connect built-in scope: offline_access", + "protocol": "openid-connect", + "attributes": { + "consent.screen.text": "${offlineAccessScopeConsentText}", + "display.on.consent.screen": "true" + } + }, + { + "id": "a3e7b19d-df6c-437e-9eea-06fec1becb2f", + "name": "phone", + "description": "OpenID Connect built-in scope: phone", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true", + "consent.screen.text": "${phoneScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "72a070f7-4363-4c88-8153-6fd2d12b9b04", + "name": "phone number verified", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "phoneNumberVerified", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "phone_number_verified", + "jsonType.label": "boolean" + } + }, + { + "id": "24b42c6d-a93c-4aa1-9a03-2a2b55954c13", + "name": "phone number", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "phoneNumber", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "phone_number", + "jsonType.label": "String" + } + } + ] + }, + { + "id": "ba8c9950-fd0b-4434-8be6-b58456d7b6d4", + "name": "profile", + "description": "OpenID Connect built-in scope: profile", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true", + "consent.screen.text": "${profileScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "0a9ddd71-309c-40f0-8ea6-a0791070c6ed", + "name": "profile", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "profile", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "profile", + "jsonType.label": "String" + } + }, + { + "id": "fbf53bbd-1ad0-4bf8-8030-50f81696d8ee", + "name": "nickname", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "nickname", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "nickname", + "jsonType.label": "String" + } + }, + { + "id": "423be2cd-42c0-462e-9030-18f9b28ff2d3", + "name": "gender", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "gender", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "gender", + "jsonType.label": "String" + } + }, + { + "id": "53eb9006-4b81-474a-8b60-80f775d54b63", + "name": "picture", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "picture", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "picture", + "jsonType.label": "String" + } + }, + { + "id": "4d8bc82a-eaeb-499e-8eb2-0f1dcbe91699", + "name": "locale", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "locale", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "locale", + "jsonType.label": "String" + } + }, + { + "id": "d3b25485-4042-419d-afff-cfd63a76e229", + "name": "full name", + "protocol": "openid-connect", + "protocolMapper": "oidc-full-name-mapper", + "consentRequired": false, + "config": { + "id.token.claim": "true", + "access.token.claim": "true", + "userinfo.token.claim": "true" + } + }, + { + "id": "422cfa5a-f2f4-4f36-82df-91b47ae1ea50", + "name": "given name", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "firstName", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "given_name", + "jsonType.label": "String" + } + }, + { + "id": "3f2863c1-d98d-45b5-b08f-af9c4d9c10f8", + "name": "website", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "website", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "website", + "jsonType.label": "String" + } + }, + { + "id": "c98c063d-eee4-41a0-9130-595afd709d1f", + "name": "middle name", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "middleName", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "middle_name", + "jsonType.label": "String" + } + }, + { + "id": "8dbed80a-d672-4185-8dda-4bba2a56ec83", + "name": "family name", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "lastName", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "family_name", + "jsonType.label": "String" + } + }, + { + "id": "5e5c690c-93cf-489d-a054-b109eab8911b", + "name": "updated at", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "updatedAt", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "updated_at", + "jsonType.label": "String" + } + }, + { + "id": "3b985202-af8a-42f1-ac5f-0966a404f5d7", + "name": "birthdate", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "birthdate", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "birthdate", + "jsonType.label": "String" + } + }, + { + "id": "6eafd1b3-7121-4919-ad1e-039fa58acc32", + "name": "username", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "username", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "preferred_username", + "jsonType.label": "String" + } + }, + { + "id": "73cba925-8c31-443f-9601-b1514e6396c1", + "name": "zoneinfo", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, + "config": { + "userinfo.token.claim": "true", + "user.attribute": "zoneinfo", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "zoneinfo", + "jsonType.label": "String" + } + } + ] + }, + { + "id": "c1a2eb23-25c6-4be7-a791-bbdca99c83f7", + "name": "read", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true" + } + }, + { + "id": "18e141bf-dabe-4858-879c-dbc439cdead4", + "name": "role_list", + "description": "SAML role list", + "protocol": "saml", + "attributes": { + "consent.screen.text": "${samlRoleListScopeConsentText}", + "display.on.consent.screen": "true" + }, + "protocolMappers": [ + { + "id": "10cbe37f-0198-4d65-bc8a-bfe5ad8145d1", + "name": "role list", + "protocol": "saml", + "protocolMapper": "saml-role-list-mapper", + "consentRequired": false, + "config": { + "single": "false", + "attribute.nameformat": "Basic", + "attribute.name": "Role" + } + } + ] + }, + { + "id": "111ed87a-5fd3-4cee-96df-8dbfb88cfdc0", + "name": "roles", + "description": "OpenID Connect scope for add user roles to the access token", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "false", + "display.on.consent.screen": "true", + "consent.screen.text": "${rolesScopeConsentText}" + }, + "protocolMappers": [ + { + "id": "24924d8d-6071-4a93-b40f-326176cb335e", + "name": "realm roles", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-realm-role-mapper", + "consentRequired": false, + "config": { + "user.attribute": "foo", + "access.token.claim": "true", + "claim.name": "realm_access.roles", + "jsonType.label": "String", + "multivalued": "true" + } + }, + { + "id": "2f6a9bdf-3758-484c-996d-e4f93555559f", + "name": "audience resolve", + "protocol": "openid-connect", + "protocolMapper": "oidc-audience-resolve-mapper", + "consentRequired": false, + "config": {} + }, + { + "id": "804d4798-d9a3-4fd3-8b28-d12142e8cb3d", + "name": "client roles", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-client-role-mapper", + "consentRequired": false, + "config": { + "user.attribute": "foo", + "access.token.claim": "true", + "claim.name": "resource_access.${client_id}.roles", + "jsonType.label": "String", + "multivalued": "true" + } + } + ] + }, + { + "id": "51d49314-b511-43e0-9258-bfb873758a78", + "name": "web-origins", + "description": "OpenID Connect scope for add allowed web origins to the access token", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "false", + "display.on.consent.screen": "false", + "consent.screen.text": "" + }, + "protocolMappers": [ + { + "id": "2b384cd0-9e85-4a87-8eeb-2b480b0587b7", + "name": "allowed web origins", + "protocol": "openid-connect", + "protocolMapper": "oidc-allowed-origins-mapper", + "consentRequired": false, + "config": {} + } + ] + }, + { + "id": "c3e253fb-7361-47cf-9d4a-86245686fdf1", + "name": "write", + "protocol": "openid-connect", + "attributes": { + "include.in.token.scope": "true", + "display.on.consent.screen": "true" + } + } + ], + "defaultDefaultClientScopes": [ + "roles", + "role_list", + "web-origins", + "email", + "profile" + ], + "defaultOptionalClientScopes": [ + "offline_access", + "address", + "phone", + "microprofile-jwt" + ], + "browserSecurityHeaders": { + "contentSecurityPolicyReportOnly": "", + "xContentTypeOptions": "nosniff", + "xRobotsTag": "none", + "xFrameOptions": "SAMEORIGIN", + "contentSecurityPolicy": "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", + "xXSSProtection": "1; mode=block", + "strictTransportSecurity": "max-age=31536000; includeSubDomains" + }, + "smtpServer": {}, + "eventsEnabled": false, + "eventsListeners": [ + "jboss-logging" + ], + "enabledEventTypes": [], + "adminEventsEnabled": false, + "adminEventsDetailsEnabled": false, + "components": { + "org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy": [ + { + "id": "84305f42-4b6d-4b0a-ac7c-53e406e3ac63", + "name": "Allowed Client Scopes", + "providerId": "allowed-client-templates", + "subType": "authenticated", + "subComponents": {}, + "config": { + "allow-default-scopes": [ + "true" + ] + } + }, + { + "id": "c7c38a95-744f-4558-a403-9cf692fe1944", + "name": "Allowed Client Scopes", + "providerId": "allowed-client-templates", + "subType": "anonymous", + "subComponents": {}, + "config": { + "allow-default-scopes": [ + "true" + ] + } + }, + { + "id": "365b2899-befe-4417-b89b-562650ec4446", + "name": "Full Scope Disabled", + "providerId": "scope", + "subType": "anonymous", + "subComponents": {}, + "config": {} + }, + { + "id": "81c32244-7921-43e9-9356-a3469259b78c", + "name": "Trusted Hosts", + "providerId": "trusted-hosts", + "subType": "anonymous", + "subComponents": {}, + "config": { + "host-sending-registration-request-must-match": [ + "true" + ], + "client-uris-must-match": [ + "true" + ] + } + }, + { + "id": "d09b2147-afea-4f7f-a49c-0aec7eee10de", + "name": "Max Clients Limit", + "providerId": "max-clients", + "subType": "anonymous", + "subComponents": {}, + "config": { + "max-clients": [ + "200" + ] + } + }, + { + "id": "41ffde1b-72a2-416f-87a7-94989e940dc0", + "name": "Allowed Protocol Mapper Types", + "providerId": "allowed-protocol-mappers", + "subType": "authenticated", + "subComponents": {}, + "config": { + "allowed-protocol-mapper-types": [ + "saml-user-attribute-mapper", + "oidc-usermodel-property-mapper", + "saml-role-list-mapper", + "oidc-sha256-pairwise-sub-mapper", + "saml-user-property-mapper", + "oidc-address-mapper", + "oidc-usermodel-attribute-mapper", + "oidc-full-name-mapper" + ] + } + }, + { + "id": "76075388-2782-4656-a986-313493239a9f", + "name": "Consent Required", + "providerId": "consent-required", + "subType": "anonymous", + "subComponents": {}, + "config": {} + }, + { + "id": "3caaf57a-9cd7-48c1-b709-b40b887414f7", + "name": "Allowed Protocol Mapper Types", + "providerId": "allowed-protocol-mappers", + "subType": "anonymous", + "subComponents": {}, + "config": { + "allowed-protocol-mapper-types": [ + "oidc-usermodel-property-mapper", + "saml-user-property-mapper", + "oidc-address-mapper", + "saml-role-list-mapper", + "oidc-usermodel-attribute-mapper", + "saml-user-attribute-mapper", + "oidc-sha256-pairwise-sub-mapper", + "oidc-full-name-mapper" + ] + } + } + ], + "org.keycloak.keys.KeyProvider": [ + { + "id": "d67a940a-52e4-44a5-9f69-6ffdd67a188f", + "name": "rsa-generated", + "providerId": "rsa-generated", + "subComponents": {}, + "config": { + "privateKey": [ + "MIIEpQIBAAKCAQEAsw+lmV2HbpgXllKS+ccyCerlWDir32Y3yFvXF3CbzYRKVg/4FddA8itMCPpPjVOAo26bi/0WImHHYPyGxSH3QQIQaSdS5AFUNarpFc9M/W4Bu7k5h8sKb+vzZA3hMLFyvmQ2JtY8Zuqi1BBB33OAlkOHprJFTrrt1xa4a6KJjKXlDp5o5hOFgvZbsW+k/fBU0CLCbL3PlXQLhqHgEncpL9L9FF/xDbPIGftxjEWcBPFG/SuyygT35xRFMxB7ifR+wJZwVnoC4RhbhgJdL2EiUVT7wq5MTsxr2j4nAAJYatK/7OTecs6y/7bGNAGEoqh4Q3X3D95YFex0scmHgY1hWwIDAQABAoIBAQCAesmnsaRrhlXmVnl/H56X3yOQmZk5Qm7kJIHBH9urKzDrb6niggDnwolcJ77M+Q1kNwkE+SPYp7AXtxo8eJKg4opD6SNg1lNF7swwCf6EGVrFB7Jv7RAgHn0VXaAnACwE0ILKew38Cn+rCb86RfYN24aJ5YA1bYsaugK5uHZZo7kLnv5PUwOwu4PqhAKLPyQt2P1gN3rzf0TGmL5Ylqoxx6X6QBKTwOqAzsWPshMxOB+GzIDDegvzQ6UIV/FzsxIZFLVAPtAWxa77TgT8LeBxDz/UF3H5cWEP5LJ3108ZUOa/EyPiIAaMsLtgVycf7gtsOEsQ4q/OqqJrL4NdNUaBAoGBAPVeguDaUwZIMOYGH2sjYaShaddMFsR2u93dj/GI/T8A4/iXz2yxfHl0LEmxQpZkzyVFpYkYO54w59zLdhzpFOkuGOMT+1j4FnMEjSnzQhZzLVxwuQ9cX0VhYRf+gpwhUOrmbPZB3tYWIiDGm823c6J4QCi0kG5R7pPb/nowpIulAoGBALrRr6RdL/lqrt/REtVW2KSdL6r38sN12vmgjBzIQFLWQFSzDxjaPLeZY87uIhpAWAuZJW+NZ7WfF85WuKDwSbuoZ1ln1yj3FkJkYZmdOid8VpEam2Z9sCncvbAq/pvhgSKMYZeXQ2+dPM0N1HiDb9SEuPIbS3hvcYwNAcLyWqj/AoGBAOfAmMVf8MMiNG1OoyZCiNtCSgG8MFToAJGRz39G8EstwCTw3k2/Zd4hSCNidY4vMSf3HF7csJK9hoIY+jpcPA/yJjd0jBaAXFPOnLZeuLEToGiLX3+Os72IOHi9PwfQv+jeM1R06tAyn5FthYNMHr/57D+GLFTGthyZ0UX/46qxAoGAJ7ENRDqYSsGjzeG5wqHk/XR4ADcV2PldQNQfcK4LHI5wtI4mkv0rEUcBsaFelX0+N5ieH4lHk4rtn+VE7MygncI10wUA7a8xh4GUSvLgvCrqqYGhqrDhkMNZeehol+3dZd21jmOQ7FHX7SkXD1O9msVoFeg+rKPg2ASbbzPWlzkCgYEAgVQKaTCgh3E2z3E9OhzeMIq7qyJuSKsP5FHsTT17U46/rPk+XBhLB/VBkY0Hn29NW4CWTmvEaJrJiejKJaPap8DBjMpJ7KnMidEeHaRykCuPmi9VUT2Q+FE5lQaPi8fYIlHI7BsIY+wTVlKRezkKpuFezocyP5YR34XDkM0BhRI=" + ], + "certificate": [ + "MIICnzCCAYcCBgFuhB77/jANBgkqhkiG9w0BAQsFADATMREwDwYDVQQDDAhiYWVsZHVuZzAeFw0xOTExMTkxNDQyMzNaFw0yOTExMTkxNDQ0MTNaMBMxETAPBgNVBAMMCGJhZWxkdW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsw+lmV2HbpgXllKS+ccyCerlWDir32Y3yFvXF3CbzYRKVg/4FddA8itMCPpPjVOAo26bi/0WImHHYPyGxSH3QQIQaSdS5AFUNarpFc9M/W4Bu7k5h8sKb+vzZA3hMLFyvmQ2JtY8Zuqi1BBB33OAlkOHprJFTrrt1xa4a6KJjKXlDp5o5hOFgvZbsW+k/fBU0CLCbL3PlXQLhqHgEncpL9L9FF/xDbPIGftxjEWcBPFG/SuyygT35xRFMxB7ifR+wJZwVnoC4RhbhgJdL2EiUVT7wq5MTsxr2j4nAAJYatK/7OTecs6y/7bGNAGEoqh4Q3X3D95YFex0scmHgY1hWwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQCLf01IsqWCKF2vw5y/NPCgKFEP4vtlXvr1XusMr9sAMSgbAVKLm5wZg4Ue8Q7iUq1LJzZ7EOeaXfIHxk33vjf0RlJQAaVn2K/kZJ4rFXuU6g+mpoRgiFsCPNexXXMdG294osyJ60g5OWCt5KrdocFjkKbF9EYm2CBj20G5MxCf+VDGDIcNvgzp478CZODiFVb6JgQqRrE3CGzQKdKiHG9cbXAledMJuWw3h0dzAqM46nl7GRkNK2cmVJO+cDD7xMrD83Q84PoG1ixMsQ/Tv5CqfREC4Dp9/j4XaoEOJ5S7oBaiRqTMzxk/lPjmbUrdyLM0Kokrrwc2yF74m9NuwHh2" + ], + "priority": [ + "100" + ] + } + }, + { + "id": "48d40de3-6234-42e8-9449-f68f56abb54b", + "name": "aes-generated", + "providerId": "aes-generated", + "subComponents": {}, + "config": { + "kid": [ + "a1643e07-7de0-4265-a42b-21152b16f2a5" + ], + "secret": [ + "KH8ObwyJF_YZ6pJ5v9YPuA" + ], + "priority": [ + "100" + ] + } + }, + { + "id": "52ea1c5d-2a30-459f-b66a-249f298b32f8", + "name": "hmac-generated", + "providerId": "hmac-generated", + "subComponents": {}, + "config": { + "kid": [ + "0d90cbd7-7164-42cc-88e2-d215e79ae8ea" + ], + "secret": [ + "AFOsLJGAelu021azV_tqcT4qhune3A0xfvGZiqfdTCBcC2UAAErphg1Q3FC4eET83w8uDyi3CMtD1v-6lXqhqw" + ], + "priority": [ + "100" + ], + "algorithm": [ + "HS256" + ] + } + } + ] + }, + "internationalizationEnabled": false, + "supportedLocales": [], + "authenticationFlows": [ + { + "id": "1dca477c-12fa-47df-a6e2-65fa08ed9565", + "alias": "Handle Existing Account", + "description": "Handle what to do if there is existing account with same email/username like authenticated identity provider", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "idp-confirm-link", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "idp-email-verification", + "requirement": "ALTERNATIVE", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "ALTERNATIVE", + "priority": 30, + "flowAlias": "Verify Existing Account by Re-authentication", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "a216230b-1eb5-4066-aa48-8556e4a50f72", + "alias": "Verify Existing Account by Re-authentication", + "description": "Reauthentication of existing account", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "idp-username-password-form", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "CONDITIONAL", + "priority": 20, + "flowAlias": "Verify Existing Account by Re-authentication - auth-otp-form - Conditional", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "c8e26747-1aca-4d11-8ce6-8a99a334aad5", + "alias": "Verify Existing Account by Re-authentication - auth-otp-form - Conditional", + "description": "Flow to determine if the auth-otp-form authenticator should be used or not.", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "conditional-user-configured", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-otp-form", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "5823f307-af3c-4b0f-83f6-a7231a57789a", + "alias": "browser", + "description": "browser based authentication", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "auth-cookie", + "requirement": "ALTERNATIVE", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-spnego", + "requirement": "DISABLED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "identity-provider-redirector", + "requirement": "ALTERNATIVE", + "priority": 25, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "ALTERNATIVE", + "priority": 30, + "flowAlias": "forms", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "c8b61763-3346-42a7-b9c1-e8d33d2d883e", + "alias": "clients", + "description": "Base authentication for clients", + "providerId": "client-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "client-secret", + "requirement": "ALTERNATIVE", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "client-jwt", + "requirement": "ALTERNATIVE", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "client-secret-jwt", + "requirement": "ALTERNATIVE", + "priority": 30, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "client-x509", + "requirement": "ALTERNATIVE", + "priority": 40, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "cb9be161-629e-4402-b6eb-d102b5a6f03b", + "alias": "direct grant", + "description": "OpenID Connect Resource Owner Grant", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "direct-grant-validate-username", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "direct-grant-validate-password", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "CONDITIONAL", + "priority": 30, + "flowAlias": "direct grant - direct-grant-validate-otp - Conditional", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "5dd842c9-1322-450f-aa65-c868cdca213e", + "alias": "direct grant - direct-grant-validate-otp - Conditional", + "description": "Flow to determine if the direct-grant-validate-otp authenticator should be used or not.", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "conditional-user-configured", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "direct-grant-validate-otp", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "9a38ae9d-c67c-43aa-a86a-44fce0394aec", + "alias": "docker auth", + "description": "Used by Docker clients to authenticate against the IDP", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "docker-http-basic-authenticator", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "77a8fa1c-689e-421c-b6de-d8d78a8a19bb", + "alias": "first broker login", + "description": "Actions taken after first broker login with identity provider account, which is not yet linked to any Keycloak account", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticatorConfig": "review profile config", + "authenticator": "idp-review-profile", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticatorConfig": "create unique user config", + "authenticator": "idp-create-user-if-unique", + "requirement": "ALTERNATIVE", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "ALTERNATIVE", + "priority": 30, + "flowAlias": "Handle Existing Account", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "6c3afd8e-1bca-45a8-bb82-f779b2cd62f7", + "alias": "forms", + "description": "Username, password, otp and other auth forms.", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "auth-username-password-form", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "CONDITIONAL", + "priority": 20, + "flowAlias": "forms - auth-otp-form - Conditional", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "8dca43f9-2dda-4ed9-9b07-ac731c610ec3", + "alias": "forms - auth-otp-form - Conditional", + "description": "Flow to determine if the auth-otp-form authenticator should be used or not.", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "conditional-user-configured", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-otp-form", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "bd7f98ba-7a67-48ba-af12-e667e13df447", + "alias": "http challenge", + "description": "An authentication flow based on challenge-response HTTP Authentication Schemes", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "no-cookie-redirect", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "basic-auth", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "basic-auth-otp", + "requirement": "DISABLED", + "priority": 30, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-spnego", + "requirement": "DISABLED", + "priority": 40, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "f36eff20-a2a9-4652-bb0c-9b4bd3c100a8", + "alias": "registration", + "description": "registration flow", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "registration-page-form", + "requirement": "REQUIRED", + "priority": 10, + "flowAlias": "registration form", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "d1536e05-0a6a-4c07-8d48-6124fd2fe835", + "alias": "registration form", + "description": "registration form", + "providerId": "form-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "registration-user-creation", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "registration-profile-action", + "requirement": "REQUIRED", + "priority": 40, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "registration-password-action", + "requirement": "REQUIRED", + "priority": 50, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "registration-recaptcha-action", + "requirement": "DISABLED", + "priority": 60, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "24504d0d-93e5-4476-b203-ba997abbd689", + "alias": "reset credentials", + "description": "Reset credentials for a user if they forgot their password or something", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "reset-credentials-choose-user", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "reset-credential-email", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "reset-password", + "requirement": "REQUIRED", + "priority": 30, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "CONDITIONAL", + "priority": 40, + "flowAlias": "reset credentials - reset-otp - Conditional", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "91ff889c-e767-4988-beff-2e3437f870aa", + "alias": "reset credentials - reset-otp - Conditional", + "description": "Flow to determine if the reset-otp authenticator should be used or not.", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "conditional-user-configured", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "reset-otp", + "requirement": "REQUIRED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + }, + { + "id": "2c6aa578-0d3a-4ad4-aa3c-f0ede99afc44", + "alias": "saml ecp", + "description": "SAML ECP Profile Authentication Flow", + "providerId": "basic-flow", + "topLevel": true, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "http-basic-authenticator", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] + } + ], + "authenticatorConfig": [ + { + "id": "f235f13d-e935-45b3-b87b-0d6faf1eebc1", + "alias": "create unique user config", + "config": { + "require.password.update.after.registration": "false" + } + }, + { + "id": "edfa789a-564c-41bd-b145-0c8493a70593", + "alias": "review profile config", + "config": { + "update.profile.on.first.login": "missing" + } + } + ], + "requiredActions": [ + { + "alias": "CONFIGURE_TOTP", + "name": "Configure OTP", + "providerId": "CONFIGURE_TOTP", + "enabled": true, + "defaultAction": false, + "priority": 10, + "config": {} + }, + { + "alias": "terms_and_conditions", + "name": "Terms and Conditions", + "providerId": "terms_and_conditions", + "enabled": false, + "defaultAction": false, + "priority": 20, + "config": {} + }, + { + "alias": "UPDATE_PASSWORD", + "name": "Update Password", + "providerId": "UPDATE_PASSWORD", + "enabled": true, + "defaultAction": false, + "priority": 30, + "config": {} + }, + { + "alias": "UPDATE_PROFILE", + "name": "Update Profile", + "providerId": "UPDATE_PROFILE", + "enabled": true, + "defaultAction": false, + "priority": 40, + "config": {} + }, + { + "alias": "VERIFY_EMAIL", + "name": "Verify Email", + "providerId": "VERIFY_EMAIL", + "enabled": true, + "defaultAction": false, + "priority": 50, + "config": {} + } + ], + "browserFlow": "browser", + "registrationFlow": "registration", + "directGrantFlow": "direct grant", + "resetCredentialsFlow": "reset credentials", + "clientAuthenticationFlow": "clients", + "dockerAuthenticationFlow": "docker auth", + "attributes": { + "webAuthnPolicyAuthenticatorAttachment": "not specified", + "_browser_header.xRobotsTag": "none", + "webAuthnPolicyRpEntityName": "keycloak", + "failureFactor": "30", + "actionTokenGeneratedByUserLifespan": "300", + "maxDeltaTimeSeconds": "43200", + "webAuthnPolicySignatureAlgorithms": "ES256", + "offlineSessionMaxLifespan": "5184000", + "_browser_header.contentSecurityPolicyReportOnly": "", + "bruteForceProtected": "false", + "_browser_header.contentSecurityPolicy": "frame-src 'self'; frame-ancestors 'self'; object-src 'none';", + "_browser_header.xXSSProtection": "1; mode=block", + "_browser_header.xFrameOptions": "SAMEORIGIN", + "_browser_header.strictTransportSecurity": "max-age=31536000; includeSubDomains", + "webAuthnPolicyUserVerificationRequirement": "not specified", + "permanentLockout": "false", + "quickLoginCheckMilliSeconds": "1000", + "webAuthnPolicyCreateTimeout": "0", + "webAuthnPolicyRequireResidentKey": "not specified", + "webAuthnPolicyRpId": "", + "webAuthnPolicyAttestationConveyancePreference": "not specified", + "maxFailureWaitSeconds": "900", + "minimumQuickLoginWaitSeconds": "60", + "webAuthnPolicyAvoidSameAuthenticatorRegister": "false", + "_browser_header.xContentTypeOptions": "nosniff", + "actionTokenGeneratedByAdminLifespan": "43200", + "waitIncrementSeconds": "60", + "offlineSessionMaxLifespanEnabled": "false" + }, + "keycloakVersion": "8.0.0", + "userManagedAccessAllowed": false +} \ No newline at end of file diff --git a/demo-person-service/.gitignore b/springdoc-openapi-oauth2/oauth-resource-server-webflux/.gitignore similarity index 100% rename from demo-person-service/.gitignore rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/.gitignore diff --git a/demo-oauth2/oauth-resource-server-webflux/pom.xml b/springdoc-openapi-oauth2/oauth-resource-server-webflux/pom.xml similarity index 81% rename from demo-oauth2/oauth-resource-server-webflux/pom.xml rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/pom.xml index 143c6deb..39b73f2a 100644 --- a/demo-oauth2/oauth-resource-server-webflux/pom.xml +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.springdoc - demo-oauth2 - 3.1.7-SNAPSHOT + springdoc-openapi-oauth2 + 3.1.6-SNAPSHOT oauth-resource-server-webflux @@ -28,14 +28,14 @@ com.h2database h2 + - org.springframework.boot - spring-boot-starter-validation + org.springdoc + springdoc-openapi-webflux-ui - org.springdoc - springdoc-openapi-starter-webflux-ui + springdoc-openapi-security diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/ResourceServerApp.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/ResourceServerApp.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/ResourceServerApp.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/ResourceServerApp.java diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java similarity index 91% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java index c15d040a..c05c736d 100644 --- a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java @@ -32,6 +32,6 @@ flows = @OAuthFlows(authorizationCode = @OAuthFlow( authorizationUrl = "${springdoc.oAuthFlow.authorizationUrl}" , tokenUrl = "${springdoc.oAuthFlow.tokenUrl}", scopes = { - @OAuthScope(name = "springdoc.read", description = "read scope"), - @OAuthScope(name = "springdoc.write", description = "write scope") }))) + @OAuthScope(name = "read", description = "read scope"), + @OAuthScope(name = "write", description = "write scope") }))) public class OpenApiConfig {} diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java similarity index 90% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java index 864c0733..9bd0c651 100644 --- a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java @@ -15,9 +15,9 @@ public SecurityWebFilterChain configure(ServerHttpSecurity http) { http .authorizeExchange().pathMatchers("/v3/api-docs/**", "/swagger-ui/**", "/webjars/**", "/swagger-ui.html").permitAll() .pathMatchers(HttpMethod.GET, "/user/info", "/api/foos/**") - .hasAuthority("SCOPE_springdoc.read") + .hasAuthority("SCOPE_read") .pathMatchers(HttpMethod.POST, "/api/foos") - .hasAuthority("SCOPE_springdoc.write") + .hasAuthority("SCOPE_write") .anyExchange().authenticated().and().oauth2ResourceServer().jwt(); diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/model/Foo.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/model/Foo.java similarity index 89% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/model/Foo.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/model/Foo.java index b589f312..e9355ee8 100644 --- a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/model/Foo.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/model/Foo.java @@ -1,9 +1,9 @@ package org.springdoc.demo.resource.model; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; @Entity public class Foo { diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java similarity index 69% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java index 947ea8d2..1d4d051a 100644 --- a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java @@ -2,8 +2,7 @@ import org.springdoc.demo.resource.model.Foo; -import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; -public interface IFooRepository extends PagingAndSortingRepository, CrudRepository { +public interface IFooRepository extends PagingAndSortingRepository { } diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/service/IFooService.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/service/IFooService.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/service/IFooService.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/service/IFooService.java diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/service/impl/FooServiceImpl.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/service/impl/FooServiceImpl.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/service/impl/FooServiceImpl.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/service/impl/FooServiceImpl.java diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/FooController.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/FooController.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/FooController.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/FooController.java diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java similarity index 95% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java index f2953a1d..984ff96e 100644 --- a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java @@ -16,6 +16,6 @@ public class UserInfoController { @GetMapping("/user/info") @SecurityRequirement(name = "security_auth") public Map getUserInfo(@AuthenticationPrincipal Jwt principal) { - return Collections.singletonMap("user_name", principal.getClaimAsString("sub")); + return Collections.singletonMap("user_name", principal.getClaimAsString("preferred_username")); } } \ No newline at end of file diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/dto/FooDTO.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/dto/FooDTO.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/dto/FooDTO.java rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/dto/FooDTO.java diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/resources/application.yml b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/resources/application.yml new file mode 100644 index 00000000..1f2107ba --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/resources/application.yml @@ -0,0 +1,23 @@ +server: + port: 8082 +####### resource server configuration properties +spring: + webflux: + base-path: /resource-server + jpa: + defer-datasource-initialization: true + security: + oauth2: + resourceserver: + jwt: + issuer-uri: ${OAUTH2_SERVER:http://localhost:8083}/auth/realms/springdoc + jwk-set-uri: ${OAUTH2_SERVER:http://localhost:8083}/auth/realms/springdoc/protocol/openid-connect/certs +springdoc: + version: '@springdoc.version@' + swagger-ui: + oauth: + clientId: newClient + clientSecret: newClientSecret + oAuthFlow: + authorizationUrl: ${OAUTH2_SERVER:http://localhost:8083}/auth/realms/springdoc/protocol/openid-connect/auth + tokenUrl: ${OAUTH2_SERVER:http://localhost:8083}/auth/realms/springdoc/protocol/openid-connect/token diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/resources/data.sql b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/resources/data.sql similarity index 100% rename from demo-oauth2/oauth-resource-server-webflux/src/main/resources/data.sql rename to springdoc-openapi-oauth2/oauth-resource-server-webflux/src/main/resources/data.sql diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/AuthorizationCodeLiveTest.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/AuthorizationCodeLiveTest.java new file mode 100644 index 00000000..44c05c95 --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/AuthorizationCodeLiveTest.java @@ -0,0 +1,81 @@ +package org.springdoc.demo.resource; + +import java.util.HashMap; +import java.util.Map; + +import io.restassured.RestAssured; +import io.restassured.response.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + +//Before running this live test make sure both authorization server and resource server are running + +public class AuthorizationCodeLiveTest { + public final static String AUTH_SERVER = "http://localhost:8083/auth/realms/springdoc/protocol/openid-connect"; + + public final static String RESOURCE_SERVER = "http://localhost:8081/resource-server"; + + private final static String REDIRECT_URL = "http://localhost:8082/new-client/login/oauth2/code/custom"; + + private final static String CLIENT_ID = "newClient"; + + private final static String CLIENT_SECRET = "newClientSecret"; + + @Test + public void givenUser_whenUseFooClient_thenOkForFooResourceOnly() { + final String accessToken = obtainAccessTokenWithAuthorizationCode("josh@test.com", "123"); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get(RESOURCE_SERVER + "/api/foos/1"); + Assertions.assertEquals(200, fooResponse.getStatusCode()); + Assertions.assertNotNull(fooResponse.jsonPath().get("name")); + + } + + private String obtainAccessTokenWithAuthorizationCode(String username, String password) { + + + String authorizeUrl = AUTH_SERVER + "/auth"; + String tokenUrl = AUTH_SERVER + "/token"; + + Map loginParams = new HashMap(); + loginParams.put("client_id", CLIENT_ID); + loginParams.put("response_type", "code"); + loginParams.put("redirect_uri", REDIRECT_URL); + loginParams.put("scope", "read write"); + + // user login + Response response = RestAssured.given().formParams(loginParams).get(authorizeUrl); + String cookieValue = response.getCookie("AUTH_SESSION_ID"); + + String authUrlWithCode = response.htmlPath().getString("'**'.find{node -> node.name()=='form'}*.@action"); + + // get code + Map codeParams = new HashMap(); + codeParams.put("username", username); + codeParams.put("password", password); + response = RestAssured.given().cookie("AUTH_SESSION_ID", cookieValue).formParams(codeParams) + .post(authUrlWithCode); + + final String location = response.getHeader(HttpHeaders.LOCATION); + + Assertions.assertEquals(HttpStatus.FOUND.value(), response.getStatusCode()); + final String code = location.split("#|=|&")[3]; + + //get access token + Map tokenParams = new HashMap(); + tokenParams.put("grant_type", "authorization_code"); + tokenParams.put("client_id", CLIENT_ID); + tokenParams.put("client_secret", CLIENT_SECRET); + tokenParams.put("redirect_uri", REDIRECT_URL); + tokenParams.put("code", code); + + response = RestAssured.given().formParams(tokenParams) + .post(tokenUrl); + + return response.jsonPath().getString("access_token"); + } + +} diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/ContextIntegrationTest.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/ContextIntegrationTest.java new file mode 100644 index 00000000..0068c239 --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/ContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.springdoc.demo.resource; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +@ExtendWith(SpringExtension.class) +@SpringBootTest(classes = { ResourceServerApp.class }) +public class ContextIntegrationTest { + + @Test + public void whenLoadApplication_thenSuccess() { + + } + +} \ No newline at end of file diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/ImplicitFlowLiveTest.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/ImplicitFlowLiveTest.java new file mode 100644 index 00000000..ed26d1b3 --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/ImplicitFlowLiveTest.java @@ -0,0 +1,73 @@ +package org.springdoc.demo.resource; + +import java.util.HashMap; +import java.util.Map; + +import io.restassured.RestAssured; +import io.restassured.response.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + +//Before running this live test make sure both authorization server and first resource server are running + +public class ImplicitFlowLiveTest { + private final static String AUTH_SERVER = "http://localhost:8083/auth/realms/springdoc/protocol/openid-connect"; + + private final static String RESOURCE_SERVER = "http://localhost:8081/resource-server"; + + private final static String REDIRECT_URL = "http://localhost:8081/resource-server/swagger-ui/oauth2-redirect.html"; + + private final static String CLIENT_ID = "newClient"; + + private final static String USERNAME = "josh@test.com"; + + private final static String PASSWORD = "123"; + + + @Test + public void givenUser_whenUseFooClient_thenOkForFooResourceOnly() { + final String accessToken = obtainAccessToken(CLIENT_ID, USERNAME, PASSWORD); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken) + .get(RESOURCE_SERVER + "/api/foos/1"); + Assertions.assertEquals(200, fooResponse.getStatusCode()); + Assertions.assertNotNull(fooResponse.jsonPath().get("name")); + } + + private String obtainAccessToken(String clientId, String username, String password) { + String authorizeUrl = AUTH_SERVER + "/auth"; + + Map loginParams = new HashMap(); + loginParams.put("grant_type", "implicit"); + loginParams.put("client_id", clientId); + loginParams.put("response_type", "token"); + loginParams.put("redirect_uri", REDIRECT_URL); + loginParams.put("scope", "oidc read write"); + + // user login + Response response = RestAssured.given().formParams(loginParams).get(authorizeUrl); + String cookieValue = response.getCookie("AUTH_SESSION_ID"); + + String authUrlWithCode = response.htmlPath().getString("'**'.find{node -> node.name()=='form'}*.@action"); + + // get access token + Map tokenParams = new HashMap(); + tokenParams.put("username", username); + tokenParams.put("password", password); + tokenParams.put("client_id", clientId); + tokenParams.put("redirect_uri", REDIRECT_URL); + response = RestAssured.given().cookie("AUTH_SESSION_ID", cookieValue).formParams(tokenParams) + .post(authUrlWithCode); + + final String location = response.getHeader(HttpHeaders.LOCATION); + + Assertions.assertEquals(HttpStatus.FOUND.value(), response.getStatusCode()); + final String accessToken = location.split("#|=|&")[4]; + return accessToken; + + } + +} diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/PasswordFlowLiveTest.java b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/PasswordFlowLiveTest.java new file mode 100644 index 00000000..84d186ef --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webflux/src/test/java/org/springdoc/demo/resource/PasswordFlowLiveTest.java @@ -0,0 +1,49 @@ +package org.springdoc.demo.resource; + +import java.util.HashMap; +import java.util.Map; + +import io.restassured.RestAssured; +import io.restassured.response.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +//Before running this live test make sure both authorization server and first resource server are running + +public class PasswordFlowLiveTest { + + private final static String AUTH_SERVER = "http://localhost:8083/auth/realms/springdoc/protocol/openid-connect"; + + private final static String RESOURCE_SERVER = "http://localhost:8081/resource-server"; + + private final static String CLIENT_ID = "newClient"; + + private final static String CLIENT_SECRET = "newClientSecret"; + + private final static String USERNAME = "josh@test.com"; + + private final static String PASSWORD = "123"; + + @Test + public void givenUser_whenUseFooClient_thenOkForFooResourceOnly() { + final String accessToken = obtainAccessToken(CLIENT_ID, USERNAME, PASSWORD); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken) + .get(RESOURCE_SERVER + "/api/foos/1"); + Assertions.assertEquals(200, fooResponse.getStatusCode()); + Assertions.assertNotNull(fooResponse.jsonPath().get("name")); + } + + private String obtainAccessToken(String clientId, String username, String password) { + final Map params = new HashMap(); + params.put("grant_type", "password"); + params.put("client_id", clientId); + params.put("username", username); + params.put("password", password); + params.put("scope", "oidc read write"); + final Response response = RestAssured.given().auth().preemptive().basic(clientId, CLIENT_SECRET).and() + .with().params(params).when().post(AUTH_SERVER + "/token"); + return response.jsonPath().getString("access_token"); + } + +} diff --git a/demo-spring-boot-3-webflux-functional/.gitignore b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/.gitignore similarity index 100% rename from demo-spring-boot-3-webflux-functional/.gitignore rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/.gitignore diff --git a/demo-oauth2/oauth-resource-server-webmvc/pom.xml b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/pom.xml similarity index 81% rename from demo-oauth2/oauth-resource-server-webmvc/pom.xml rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/pom.xml index 3aef8ed9..b110d395 100644 --- a/demo-oauth2/oauth-resource-server-webmvc/pom.xml +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/pom.xml @@ -4,8 +4,8 @@ 4.0.0 org.springdoc - demo-oauth2 - 3.1.7-SNAPSHOT + springdoc-openapi-oauth2 + 3.1.6-SNAPSHOT oauth-resource-server-webmvc @@ -28,14 +28,14 @@ com.h2database h2 + - org.springframework.boot - spring-boot-starter-validation + org.springdoc + springdoc-openapi-ui - org.springdoc - springdoc-openapi-starter-webmvc-ui + springdoc-openapi-security diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/ResourceServerApp.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/ResourceServerApp.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/ResourceServerApp.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/ResourceServerApp.java diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java similarity index 91% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java index c15d040a..c05c736d 100644 --- a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/OpenApiConfig.java @@ -32,6 +32,6 @@ flows = @OAuthFlows(authorizationCode = @OAuthFlow( authorizationUrl = "${springdoc.oAuthFlow.authorizationUrl}" , tokenUrl = "${springdoc.oAuthFlow.tokenUrl}", scopes = { - @OAuthScope(name = "springdoc.read", description = "read scope"), - @OAuthScope(name = "springdoc.write", description = "write scope") }))) + @OAuthScope(name = "read", description = "read scope"), + @OAuthScope(name = "write", description = "write scope") }))) public class OpenApiConfig {} diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java new file mode 100644 index 00000000..07754a0f --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/config/SecurityConfig.java @@ -0,0 +1,27 @@ +package org.springdoc.demo.resource.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception {// @formatter:off + http + .authorizeRequests() + .antMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll() + .antMatchers(HttpMethod.GET, "/user/info", "/api/foos/**") + .hasAuthority("SCOPE_read") + .antMatchers(HttpMethod.POST, "/api/foos") + .hasAuthority("SCOPE_write") + .anyRequest() + .authenticated() + .and() + .oauth2ResourceServer() + .jwt(); + } + +} \ No newline at end of file diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/model/Foo.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/model/Foo.java similarity index 89% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/model/Foo.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/model/Foo.java index b589f312..e9355ee8 100644 --- a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/model/Foo.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/model/Foo.java @@ -1,9 +1,9 @@ package org.springdoc.demo.resource.model; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; @Entity public class Foo { diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java similarity index 69% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java index 947ea8d2..1d4d051a 100644 --- a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/repository/IFooRepository.java @@ -2,8 +2,7 @@ import org.springdoc.demo.resource.model.Foo; -import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; -public interface IFooRepository extends PagingAndSortingRepository, CrudRepository { +public interface IFooRepository extends PagingAndSortingRepository { } diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/service/IFooService.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/service/IFooService.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/service/IFooService.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/service/IFooService.java diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/service/impl/FooServiceImpl.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/service/impl/FooServiceImpl.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/service/impl/FooServiceImpl.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/service/impl/FooServiceImpl.java diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/FooController.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/FooController.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/FooController.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/FooController.java diff --git a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java similarity index 95% rename from demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java index f2953a1d..984ff96e 100644 --- a/demo-oauth2/oauth-resource-server-webflux/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/controller/UserInfoController.java @@ -16,6 +16,6 @@ public class UserInfoController { @GetMapping("/user/info") @SecurityRequirement(name = "security_auth") public Map getUserInfo(@AuthenticationPrincipal Jwt principal) { - return Collections.singletonMap("user_name", principal.getClaimAsString("sub")); + return Collections.singletonMap("user_name", principal.getClaimAsString("preferred_username")); } } \ No newline at end of file diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/dto/FooDTO.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/dto/FooDTO.java similarity index 100% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/dto/FooDTO.java rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/java/org/springdoc/demo/resource/web/dto/FooDTO.java diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/resources/application.yml b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/resources/application.yml new file mode 100644 index 00000000..1d7ddd3c --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/resources/application.yml @@ -0,0 +1,24 @@ +server: + port: 8081 + servlet: + context-path: /resource-server + +####### resource server configuration properties +spring: + jpa: + defer-datasource-initialization: true + security: + oauth2: + resourceserver: + jwt: + issuer-uri: ${OAUTH2_SERVER:http://localhost:8083}/auth/realms/springdoc + jwk-set-uri: ${OAUTH2_SERVER:http://localhost:8083}/auth/realms/springdoc/protocol/openid-connect/certs +springdoc: + version: '@springdoc.version@' + swagger-ui: + oauth: + clientId: newClient + clientSecret: newClientSecret + oAuthFlow: + authorizationUrl: ${OAUTH2_SERVER:http://localhost:8083}/auth/realms/springdoc/protocol/openid-connect/auth + tokenUrl: ${OAUTH2_SERVER:http://localhost:8083}/auth/realms/springdoc/protocol/openid-connect/token diff --git a/demo-oauth2/oauth-resource-server-webmvc/src/main/resources/data.sql b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/resources/data.sql similarity index 100% rename from demo-oauth2/oauth-resource-server-webmvc/src/main/resources/data.sql rename to springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/main/resources/data.sql diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/AuthorizationCodeLiveTest.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/AuthorizationCodeLiveTest.java new file mode 100644 index 00000000..44c05c95 --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/AuthorizationCodeLiveTest.java @@ -0,0 +1,81 @@ +package org.springdoc.demo.resource; + +import java.util.HashMap; +import java.util.Map; + +import io.restassured.RestAssured; +import io.restassured.response.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + +//Before running this live test make sure both authorization server and resource server are running + +public class AuthorizationCodeLiveTest { + public final static String AUTH_SERVER = "http://localhost:8083/auth/realms/springdoc/protocol/openid-connect"; + + public final static String RESOURCE_SERVER = "http://localhost:8081/resource-server"; + + private final static String REDIRECT_URL = "http://localhost:8082/new-client/login/oauth2/code/custom"; + + private final static String CLIENT_ID = "newClient"; + + private final static String CLIENT_SECRET = "newClientSecret"; + + @Test + public void givenUser_whenUseFooClient_thenOkForFooResourceOnly() { + final String accessToken = obtainAccessTokenWithAuthorizationCode("josh@test.com", "123"); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get(RESOURCE_SERVER + "/api/foos/1"); + Assertions.assertEquals(200, fooResponse.getStatusCode()); + Assertions.assertNotNull(fooResponse.jsonPath().get("name")); + + } + + private String obtainAccessTokenWithAuthorizationCode(String username, String password) { + + + String authorizeUrl = AUTH_SERVER + "/auth"; + String tokenUrl = AUTH_SERVER + "/token"; + + Map loginParams = new HashMap(); + loginParams.put("client_id", CLIENT_ID); + loginParams.put("response_type", "code"); + loginParams.put("redirect_uri", REDIRECT_URL); + loginParams.put("scope", "read write"); + + // user login + Response response = RestAssured.given().formParams(loginParams).get(authorizeUrl); + String cookieValue = response.getCookie("AUTH_SESSION_ID"); + + String authUrlWithCode = response.htmlPath().getString("'**'.find{node -> node.name()=='form'}*.@action"); + + // get code + Map codeParams = new HashMap(); + codeParams.put("username", username); + codeParams.put("password", password); + response = RestAssured.given().cookie("AUTH_SESSION_ID", cookieValue).formParams(codeParams) + .post(authUrlWithCode); + + final String location = response.getHeader(HttpHeaders.LOCATION); + + Assertions.assertEquals(HttpStatus.FOUND.value(), response.getStatusCode()); + final String code = location.split("#|=|&")[3]; + + //get access token + Map tokenParams = new HashMap(); + tokenParams.put("grant_type", "authorization_code"); + tokenParams.put("client_id", CLIENT_ID); + tokenParams.put("client_secret", CLIENT_SECRET); + tokenParams.put("redirect_uri", REDIRECT_URL); + tokenParams.put("code", code); + + response = RestAssured.given().formParams(tokenParams) + .post(tokenUrl); + + return response.jsonPath().getString("access_token"); + } + +} diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/ContextIntegrationTest.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/ContextIntegrationTest.java new file mode 100644 index 00000000..0068c239 --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/ContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.springdoc.demo.resource; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +@ExtendWith(SpringExtension.class) +@SpringBootTest(classes = { ResourceServerApp.class }) +public class ContextIntegrationTest { + + @Test + public void whenLoadApplication_thenSuccess() { + + } + +} \ No newline at end of file diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/ImplicitFlowLiveTest.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/ImplicitFlowLiveTest.java new file mode 100644 index 00000000..ed26d1b3 --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/ImplicitFlowLiveTest.java @@ -0,0 +1,73 @@ +package org.springdoc.demo.resource; + +import java.util.HashMap; +import java.util.Map; + +import io.restassured.RestAssured; +import io.restassured.response.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; + +//Before running this live test make sure both authorization server and first resource server are running + +public class ImplicitFlowLiveTest { + private final static String AUTH_SERVER = "http://localhost:8083/auth/realms/springdoc/protocol/openid-connect"; + + private final static String RESOURCE_SERVER = "http://localhost:8081/resource-server"; + + private final static String REDIRECT_URL = "http://localhost:8081/resource-server/swagger-ui/oauth2-redirect.html"; + + private final static String CLIENT_ID = "newClient"; + + private final static String USERNAME = "josh@test.com"; + + private final static String PASSWORD = "123"; + + + @Test + public void givenUser_whenUseFooClient_thenOkForFooResourceOnly() { + final String accessToken = obtainAccessToken(CLIENT_ID, USERNAME, PASSWORD); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken) + .get(RESOURCE_SERVER + "/api/foos/1"); + Assertions.assertEquals(200, fooResponse.getStatusCode()); + Assertions.assertNotNull(fooResponse.jsonPath().get("name")); + } + + private String obtainAccessToken(String clientId, String username, String password) { + String authorizeUrl = AUTH_SERVER + "/auth"; + + Map loginParams = new HashMap(); + loginParams.put("grant_type", "implicit"); + loginParams.put("client_id", clientId); + loginParams.put("response_type", "token"); + loginParams.put("redirect_uri", REDIRECT_URL); + loginParams.put("scope", "oidc read write"); + + // user login + Response response = RestAssured.given().formParams(loginParams).get(authorizeUrl); + String cookieValue = response.getCookie("AUTH_SESSION_ID"); + + String authUrlWithCode = response.htmlPath().getString("'**'.find{node -> node.name()=='form'}*.@action"); + + // get access token + Map tokenParams = new HashMap(); + tokenParams.put("username", username); + tokenParams.put("password", password); + tokenParams.put("client_id", clientId); + tokenParams.put("redirect_uri", REDIRECT_URL); + response = RestAssured.given().cookie("AUTH_SESSION_ID", cookieValue).formParams(tokenParams) + .post(authUrlWithCode); + + final String location = response.getHeader(HttpHeaders.LOCATION); + + Assertions.assertEquals(HttpStatus.FOUND.value(), response.getStatusCode()); + final String accessToken = location.split("#|=|&")[4]; + return accessToken; + + } + +} diff --git a/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/PasswordFlowLiveTest.java b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/PasswordFlowLiveTest.java new file mode 100644 index 00000000..84d186ef --- /dev/null +++ b/springdoc-openapi-oauth2/oauth-resource-server-webmvc/src/test/java/org/springdoc/demo/resource/PasswordFlowLiveTest.java @@ -0,0 +1,49 @@ +package org.springdoc.demo.resource; + +import java.util.HashMap; +import java.util.Map; + +import io.restassured.RestAssured; +import io.restassured.response.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +//Before running this live test make sure both authorization server and first resource server are running + +public class PasswordFlowLiveTest { + + private final static String AUTH_SERVER = "http://localhost:8083/auth/realms/springdoc/protocol/openid-connect"; + + private final static String RESOURCE_SERVER = "http://localhost:8081/resource-server"; + + private final static String CLIENT_ID = "newClient"; + + private final static String CLIENT_SECRET = "newClientSecret"; + + private final static String USERNAME = "josh@test.com"; + + private final static String PASSWORD = "123"; + + @Test + public void givenUser_whenUseFooClient_thenOkForFooResourceOnly() { + final String accessToken = obtainAccessToken(CLIENT_ID, USERNAME, PASSWORD); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken) + .get(RESOURCE_SERVER + "/api/foos/1"); + Assertions.assertEquals(200, fooResponse.getStatusCode()); + Assertions.assertNotNull(fooResponse.jsonPath().get("name")); + } + + private String obtainAccessToken(String clientId, String username, String password) { + final Map params = new HashMap(); + params.put("grant_type", "password"); + params.put("client_id", clientId); + params.put("username", username); + params.put("password", password); + params.put("scope", "oidc read write"); + final Response response = RestAssured.given().auth().preemptive().basic(clientId, CLIENT_SECRET).and() + .with().params(params).when().post(AUTH_SERVER + "/token"); + return response.jsonPath().getString("access_token"); + } + +} diff --git a/demo-oauth2/pom.xml b/springdoc-openapi-oauth2/pom.xml similarity index 83% rename from demo-oauth2/pom.xml rename to springdoc-openapi-oauth2/pom.xml index 82f5421b..1588b708 100644 --- a/demo-oauth2/pom.xml +++ b/springdoc-openapi-oauth2/pom.xml @@ -6,10 +6,15 @@ springdoc-openapi-demos org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT pom - demo-oauth2 + springdoc-openapi-oauth2 + + + 11 + openjdk:11-jre-slim + oauth-authorization-server diff --git a/demo-person-service/.gitattributes b/springdoc-openapi-person-service/.gitattributes similarity index 100% rename from demo-person-service/.gitattributes rename to springdoc-openapi-person-service/.gitattributes diff --git a/demo-spring-boot-3-webflux/.gitignore b/springdoc-openapi-person-service/.gitignore similarity index 100% rename from demo-spring-boot-3-webflux/.gitignore rename to springdoc-openapi-person-service/.gitignore diff --git a/demo-person-service/README.md b/springdoc-openapi-person-service/README.md similarity index 100% rename from demo-person-service/README.md rename to springdoc-openapi-person-service/README.md diff --git a/demo-person-service/pom.xml b/springdoc-openapi-person-service/pom.xml similarity index 70% rename from demo-person-service/pom.xml rename to springdoc-openapi-person-service/pom.xml index d89284ee..da34ee95 100644 --- a/demo-person-service/pom.xml +++ b/springdoc-openapi-person-service/pom.xml @@ -6,10 +6,10 @@ springdoc-openapi-demos org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT Demo project for Spring Boot with openapi 3 documentation - demo-person-service + springdoc-openapi-person-service @@ -19,7 +19,7 @@ org.springdoc - springdoc-openapi-starter-webmvc-ui + springdoc-openapi-ui org.javamoney.moneta @@ -32,5 +32,16 @@ 1.1.1 - + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/demo-person-service/src/main/java/org/springdoc/demo/services/person/SampleApplication.java b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/SampleApplication.java similarity index 100% rename from demo-person-service/src/main/java/org/springdoc/demo/services/person/SampleApplication.java rename to springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/SampleApplication.java diff --git a/demo-person-service/src/main/java/org/springdoc/demo/services/person/config/SampleConfig.java b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/config/SampleConfig.java similarity index 85% rename from demo-person-service/src/main/java/org/springdoc/demo/services/person/config/SampleConfig.java rename to springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/config/SampleConfig.java index a356789d..da6ca3b2 100644 --- a/demo-person-service/src/main/java/org/springdoc/demo/services/person/config/SampleConfig.java +++ b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/config/SampleConfig.java @@ -1,15 +1,15 @@ package org.springdoc.demo.services.person.config; +import javax.annotation.PostConstruct; import javax.money.MonetaryAmount; -import jakarta.annotation.PostConstruct; import org.javamoney.moneta.Money; import org.zalando.jackson.datatype.money.MoneyModule; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import static org.springdoc.core.utils.SpringDocUtils.getConfig; +import static org.springdoc.core.SpringDocUtils.getConfig; @Configuration public class SampleConfig { diff --git a/demo-person-service/src/main/java/org/springdoc/demo/services/person/controller/PersonController.java b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/controller/PersonController.java similarity index 90% rename from demo-person-service/src/main/java/org/springdoc/demo/services/person/controller/PersonController.java rename to springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/controller/PersonController.java index 9e68a8c8..e04c1f5a 100644 --- a/demo-person-service/src/main/java/org/springdoc/demo/services/person/controller/PersonController.java +++ b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/controller/PersonController.java @@ -4,9 +4,10 @@ import java.util.List; import java.util.Random; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + import org.springdoc.demo.services.person.model.Person; import org.springframework.web.bind.annotation.GetMapping; diff --git a/demo-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/ErrorMessage.java b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/ErrorMessage.java similarity index 100% rename from demo-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/ErrorMessage.java rename to springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/ErrorMessage.java diff --git a/demo-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/GlobalControllerAdvice.java b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/GlobalControllerAdvice.java similarity index 97% rename from demo-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/GlobalControllerAdvice.java rename to springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/GlobalControllerAdvice.java index 6dc0f6f9..acf97fd6 100644 --- a/demo-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/GlobalControllerAdvice.java +++ b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/GlobalControllerAdvice.java @@ -5,8 +5,9 @@ import java.util.Set; import java.util.UUID; -import jakarta.validation.ConstraintViolation; -import jakarta.validation.ConstraintViolationException; +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springdoc.demo.services.person.controller.PersonController; diff --git a/demo-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/Problem.java b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/Problem.java similarity index 100% rename from demo-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/Problem.java rename to springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/exceptions/Problem.java diff --git a/demo-person-service/src/main/java/org/springdoc/demo/services/person/model/Person.java b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/model/Person.java similarity index 83% rename from demo-person-service/src/main/java/org/springdoc/demo/services/person/model/Person.java rename to springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/model/Person.java index c2724c7c..507eaef6 100644 --- a/demo-person-service/src/main/java/org/springdoc/demo/services/person/model/Person.java +++ b/springdoc-openapi-person-service/src/main/java/org/springdoc/demo/services/person/model/Person.java @@ -1,14 +1,14 @@ package org.springdoc.demo.services.person.model; import javax.money.MonetaryAmount; +import javax.validation.constraints.Email; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; import com.fasterxml.jackson.annotation.JsonProperty; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.Max; -import jakarta.validation.constraints.Min; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Pattern; -import jakarta.validation.constraints.Size; public class Person { diff --git a/springdoc-openapi-person-service/src/main/resources/application.properties b/springdoc-openapi-person-service/src/main/resources/application.properties new file mode 100644 index 00000000..855e1fe0 --- /dev/null +++ b/springdoc-openapi-person-service/src/main/resources/application.properties @@ -0,0 +1 @@ +springdoc.version=@springdoc.version@ \ No newline at end of file diff --git a/demo-spring-data-rest/.gitignore b/springdoc-openapi-spring-boot-1/.gitignore similarity index 100% rename from demo-spring-data-rest/.gitignore rename to springdoc-openapi-spring-boot-1/.gitignore diff --git a/springdoc-openapi-spring-boot-1/pom.xml b/springdoc-openapi-spring-boot-1/pom.xml new file mode 100644 index 00000000..4f00658c --- /dev/null +++ b/springdoc-openapi-spring-boot-1/pom.xml @@ -0,0 +1,74 @@ + + 4.0.0 + + org.springdoc + springdoc-openapi-demos + 3.1.6-SNAPSHOT + + springdoc-openapi-spring-boot-1 + + 1.5.22.RELEASE + 2.10.1 + + + + org.springframework.boot + spring-boot-starter-web + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.core + jackson-annotations + + + + + + org.springdoc + springdoc-openapi-ui + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + ${jackson.version} + + + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot-maven-plugin.version} + + + + \ No newline at end of file diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/Application.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/Application.java new file mode 100644 index 00000000..5be079a3 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/Application.java @@ -0,0 +1,59 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import org.springdoc.core.SpringDocUtils; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.web.BasicErrorController; +import org.springframework.context.annotation.Bean; +import org.springframework.web.filter.ForwardedHeaderFilter; + +@SpringBootApplication +public class Application { + + static { + SpringDocUtils.getConfig().addHiddenRestControllers(BasicErrorController.class); + } + + public static void main(String[] args) { + SpringApplication.run(Application.class); + } + + @Bean + public OpenAPI customOpenAPI(@Value("${springdoc.version}") String appVersion) { + return new OpenAPI() + .components(new Components()) + .info(new Info().title("Store API").version(appVersion) + .license(new License().name("Apache 2.0").url("http://springdoc.org"))); + } + + @Bean + ForwardedHeaderFilter forwardedHeaderFilter() { + return new ForwardedHeaderFilter(); + } + +} + diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ErrorMessage.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ErrorMessage.java new file mode 100644 index 00000000..dd6198bb --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ErrorMessage.java @@ -0,0 +1,48 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample1; + +public class ErrorMessage { + + private String id; + + private String message; + + public ErrorMessage(String id, String message2) { + this.id = id; + this.message = message2; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ExceptionTranslator.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ExceptionTranslator.java new file mode 100644 index 00000000..cc0a1f83 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ExceptionTranslator.java @@ -0,0 +1,48 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample1; + +import java.util.UUID; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ControllerAdvice +public class ExceptionTranslator { + + private static final Logger LOGGER = LoggerFactory.getLogger(ExceptionTranslator.class); + + @ExceptionHandler({ RuntimeException.class }) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + public ResponseEntity handleRunTimeException(RuntimeException e) { + return error(HttpStatus.INTERNAL_SERVER_ERROR, e); + } + + + private ResponseEntity error(HttpStatus status, Exception e) { + LOGGER.error("Exception : ", e); + return ResponseEntity.status(status).body(new ErrorMessage(UUID.randomUUID().toString(), e.getMessage())); + } +} \ No newline at end of file diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/HelloController.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/HelloController.java new file mode 100644 index 00000000..77ff6e6d --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/HelloController.java @@ -0,0 +1,40 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample1; + +import org.hibernate.validator.constraints.SafeHtml.Tag; +import org.springdoc.api.annotations.ParameterObject; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class HelloController { + + @GetMapping(value = "/hello/{numTelco}") + @ResponseStatus(HttpStatus.I_AM_A_TEAPOT) + @Tag(name = "tea") + public String index(@PathVariable("numTelco") String numTel, @ParameterObject PersonDTO personDTO) { + return "Greetings from Spring Boot!"; + } + +} \ No newline at end of file diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemController.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemController.java new file mode 100644 index 00000000..d507f0dc --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemController.java @@ -0,0 +1,61 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample1; + +import java.net.URI; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import javax.validation.Valid; +import javax.validation.constraints.Size; + +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.tags.Tag; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; + +@RestController +@Tag(name = "items") +public class ItemController { + + @GetMapping("/items") + public List showItems(@RequestParam("cusID") @Size(min = 4, max = 6) final String customerID, + @Size(min = 4, max = 6) int toto, + @Parameter(name = "start", in = ParameterIn.QUERY, required = false, schema = @Schema(type = "string", format = "date-time", required = false, example = "1970-01-01T00:00:00.000Z")) @RequestParam(value = "start", required = false) Instant startDate) { + return new ArrayList(); + } + + @PostMapping("/items") + public ResponseEntity addItem(@Valid @RequestBody final ItemLightDTO itemDTO) { + final URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}") + .buildAndExpand(UUID.randomUUID()).toUri(); + return ResponseEntity.created(location).build(); + } + +} \ No newline at end of file diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemDTO.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemDTO.java new file mode 100644 index 00000000..92e7a7e0 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemDTO.java @@ -0,0 +1,116 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample1; + +import java.io.Serializable; + +/** + * @author 472957 + */ +public class ItemDTO implements Serializable { + + /** + * serialVersionUID of type long + */ + private static final long serialVersionUID = 1L; + + /** + * itemID of type String + */ + private String itemID; + + /** + * description of type String + */ + private String description; + + /** + * price of type int + */ + private int price; + + /** + * + */ + public ItemDTO() { + } + + /** + * @param description description + * @param price price + */ + public ItemDTO(final String description, final int price) { + this.description = description; + this.price = price; + } + + /** + * @param itemID itemID + * @param description description + * @param price price + */ + public ItemDTO(final String itemID, final String description, final int price) { + this.itemID = itemID; + this.description = description; + this.price = price; + } + + /** + * @return + */ + public String getDescription() { + return description; + } + + /** + * @param description description + */ + public void setDescription(final String description) { + this.description = description; + } + + /** + * @return + */ + public String getItemID() { + return itemID; + } + + /** + * @param itemID itemID + */ + public void setItemID(final String itemID) { + this.itemID = itemID; + } + + /** + * @return + */ + public int getPrice() { + return price; + } + + /** + * @param price price + */ + public void setPrice(final int price) { + this.price = price; + } + +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemLightDTO.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemLightDTO.java new file mode 100644 index 00000000..d1d0258d --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/ItemLightDTO.java @@ -0,0 +1,83 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample1; + +import java.io.Serializable; + +/** + * @author 472957 + */ +public class ItemLightDTO implements Serializable { + + /** + * serialVersionUID of type long + */ + private static final long serialVersionUID = 1L; + + /** + * description of type String + */ + private String description; + + /** + * price of type int + */ + private int price; + + /** + * + */ + public ItemLightDTO() { + } + + public ItemLightDTO(String description, int price) { + super(); + this.description = description; + this.price = price; + } + + /** + * @return + */ + public String getDescription() { + return description; + } + + /** + * @param description description + */ + public void setDescription(final String description) { + this.description = description; + } + + /** + * @return + */ + public int getPrice() { + return price; + } + + /** + * @param price price + */ + public void setPrice(final int price) { + this.price = price; + } + +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/PeopleRestService.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/PeopleRestService.java new file mode 100644 index 00000000..72d35964 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/PeopleRestService.java @@ -0,0 +1,107 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample1; + +import java.net.URI; +import java.util.Collection; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.headers.Header; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; + +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; + +@RestController +@Tag(name = "people") +public class PeopleRestService { + private Map people = new ConcurrentHashMap<>(); + + @GetMapping(value = "/people", produces = MediaType.APPLICATION_JSON_VALUE) + @Operation(description = "List all people", responses = { + @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = PersonDTO.class))), responseCode = "200") }) + public Collection getPeople() { + return people.values(); + } + + @Operation(description = "Find person by e-mail", responses = { + @ApiResponse(content = @Content(schema = @Schema(implementation = PersonDTO.class)), responseCode = "200"), + @ApiResponse(responseCode = "404", description = "Person with such e-mail doesn't exists") }) + @GetMapping(value = "/{email}", produces = MediaType.APPLICATION_JSON_VALUE) + public PersonDTO findPerson( + @Parameter(description = "E-Mail address to lookup for", required = true) @PathVariable("email") final String email) { + + final PersonDTO person = people.get(email); + + if (person == null) { + throw new RuntimeException("Person with such e-mail doesn't exists"); + } + + return person; + } + + @PostMapping(value = "/{email}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) + @Operation(description = "Create new person", responses = { + @ApiResponse(content = @Content(schema = @Schema(implementation = PersonDTO.class), mediaType = MediaType.APPLICATION_JSON_UTF8_VALUE), headers = @Header(name = "Location"), responseCode = "201"), + @ApiResponse(responseCode = "409", description = "Person with such e-mail already exists") }) + public ResponseEntity addPerson( + @Parameter(description = "E-Mail", required = true) @PathVariable("email") final String email, + @Parameter(description = "First Name", required = true) @RequestParam("firstName") final String firstName, + @Parameter(description = "Last Name", required = true) @RequestParam("lastName") final String lastName) { + + final PersonDTO person = people.get(email); + + if (person != null) { + return ResponseEntity.status(HttpStatus.CONFLICT).body("Person with such e-mail already exists"); + } + + people.put(email, new PersonDTO(email, firstName, lastName)); + final URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}") + .buildAndExpand(UUID.randomUUID()).toUri(); + return ResponseEntity.created(location).build(); + } + + @DeleteMapping(value = "/{email}") + @Operation(description = "Delete existing person", responses = { + @ApiResponse(responseCode = "204", description = "Person has been deleted"), + @ApiResponse(responseCode = "404", description = "Person with such e-mail doesn't exists") }) + public ResponseEntity deletePerson( + @Parameter(description = "E-Mail address to lookup for", required = true) @PathVariable("email") final String email) { + if (people.remove(email) == null) { + throw new RuntimeException("Person with such e-mail doesn't exists"); + } + return ResponseEntity.noContent().build(); + } +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/PersonDTO.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/PersonDTO.java new file mode 100644 index 00000000..adf0138b --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample1/PersonDTO.java @@ -0,0 +1,60 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample1; + +public class PersonDTO { + private String email; + + private String firstName; + + private String lastName; + + public PersonDTO() { + } + + public PersonDTO(final String email, final String firstName, final String lastName) { + this.email = email; + this.firstName = firstName; + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(final String email) { + this.email = email; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(final String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(final String lastName) { + this.lastName = lastName; + } +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiException.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiException.java new file mode 100644 index 00000000..2f4bf650 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiException.java @@ -0,0 +1,33 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample2; + +public final class ApiException extends Exception { + + private static final long serialVersionUID = 1L; + + @SuppressWarnings("unused") + + private final int code; + + public ApiException(int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiOriginFilter.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiOriginFilter.java new file mode 100644 index 00000000..892b7e28 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiOriginFilter.java @@ -0,0 +1,49 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample2; + +import java.io.IOException; + +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-08T09:37:36.546Z[GMT]") +public class ApiOriginFilter implements javax.servlet.Filter { + @Override + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + @Override + public void destroy() { + } + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiResponseMessage.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiResponseMessage.java new file mode 100644 index 00000000..9c3baea7 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/ApiResponseMessage.java @@ -0,0 +1,94 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample2; + +import javax.xml.bind.annotation.XmlTransient; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-08T09:37:36.546Z[GMT]") +@javax.xml.bind.annotation.XmlRootElement +public class ApiResponseMessage { + public static final int ERROR = 1; + + public static final int WARNING = 2; + + public static final int INFO = 3; + + public static final int OK = 4; + + public static final int TOO_BUSY = 5; + + int code; + + String type; + + String message; + + public ApiResponseMessage() { + } + + public ApiResponseMessage(int code, String message) { + this.code = code; + switch (code) { + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryApi.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryApi.java new file mode 100644 index 00000000..c7057423 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryApi.java @@ -0,0 +1,68 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +/** + * NOTE: This class is auto generated by the swagger code generator program (3.0.8). + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ +package org.springdoc.demo.app1.sample2; + +import java.util.List; + +import javax.validation.Valid; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-08T09:37:36.546Z[GMT]") +@Tag(name = "inventory") +public interface InventoryApi { + + + @Operation(description = "adds an inventory item", operationId = "addInventory", summary = "Adds an item to the system", tags = { + "admins", }) + @ApiResponses(value = { @ApiResponse(responseCode = "201", description = "item created"), + @ApiResponse(responseCode = "400", description = "invalid input, object invalid"), + @ApiResponse(responseCode = "409", description = "an existing item already exists") }) + @PostMapping(value = "/inventory", consumes = { "application/json" }) + ResponseEntity addInventory( + @Parameter(description = "Inventory item to do") @Valid @RequestBody InventoryItem body); + + @Operation(description = "searches inventory", operationId = "searchInventory", summary = "By passing in the appropriate options, you can search for available inventory in the system ", tags = { + "developers", }) + @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "search results matching criteria"), + @ApiResponse(responseCode = "400", description = "bad input parameter") }) + @GetMapping(value = "/inventory", produces = { "application/json" }) + ResponseEntity> searchInventory( + @Valid @RequestParam(value = "searchString", required = false) String searchString, + @Min(0) @Parameter(description = "number of records to skip for pagination") @Valid @RequestParam(value = "skip", required = true) Integer skip, + @Min(0) @Max(50) @Parameter(description = "maximum number of records to return") @Valid @RequestParam(value = "limit", required = true) Integer limit); + +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryApiController.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryApiController.java new file mode 100644 index 00000000..146e3478 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryApiController.java @@ -0,0 +1,72 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample2; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; +import javax.validation.Valid; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.swagger.v3.oas.annotations.Parameter; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-08T09:37:36.546Z[GMT]") +@RestController +public class InventoryApiController implements InventoryApi { + + + @SuppressWarnings("unused") + private final ObjectMapper objectMapper; + + private final HttpServletRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public InventoryApiController(ObjectMapper objectMapper, HttpServletRequest request) { + this.objectMapper = objectMapper; + this.request = request; + } + + public ResponseEntity addInventory( + @Parameter(description = "Inventory item to add") @Valid @RequestBody InventoryItem body) { + @SuppressWarnings("unused") + String accept = request.getHeader("Accept"); + return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED); + } + + public ResponseEntity> searchInventory(String searchString, + @Min(0) @Valid @RequestParam(value = "skip", required = true) Integer skip, + @Min(0) @Max(50) @Valid @RequestParam(value = "limit", required = true) Integer limit) { + @SuppressWarnings("unused") + String accept = request.getHeader("Accept"); + return new ResponseEntity>(HttpStatus.NOT_IMPLEMENTED); + } + + public String getme(String language) { + return language; + } + +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryItem.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryItem.java new file mode 100644 index 00000000..90fb9ba1 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/InventoryItem.java @@ -0,0 +1,180 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample2; + +import java.util.Objects; +import java.util.UUID; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import org.springframework.validation.annotation.Validated; + +/** + * InventoryItem + */ +@Validated +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-08T09:37:36.546Z[GMT]") +public class InventoryItem { + @JsonProperty("id") + private UUID id = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("releaseDate") + private String releaseDate = null; + + @JsonProperty("manufacturer") + private Manufacturer manufacturer = null; + + public InventoryItem id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id + **/ + @Schema(example = "d290f1ee-6c54-4b01-90e6-d701748f0851", required = true) + @NotNull + + @Valid + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public InventoryItem name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + **/ + @Schema(example = "Widget Adapter", required = true) + @NotNull + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public InventoryItem releaseDate(String releaseDate) { + this.releaseDate = releaseDate; + return this; + } + + /** + * Get releaseDate + * + * @return releaseDate + **/ + @Schema(example = "2016-08-29T09:12:33.001Z", required = true) + @NotNull + + public String getReleaseDate() { + return releaseDate; + } + + public void setReleaseDate(String releaseDate) { + this.releaseDate = releaseDate; + } + + public InventoryItem manufacturer(Manufacturer manufacturer) { + this.manufacturer = manufacturer; + return this; + } + + /** + * Get manufacturer + * + * @return manufacturer + **/ + @Schema(required = true) + @NotNull + + @Valid + public Manufacturer getManufacturer() { + return manufacturer; + } + + public void setManufacturer(Manufacturer manufacturer) { + this.manufacturer = manufacturer; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InventoryItem inventoryItem = (InventoryItem) o; + return Objects.equals(this.id, inventoryItem.id) && + Objects.equals(this.name, inventoryItem.name) && + Objects.equals(this.releaseDate, inventoryItem.releaseDate) && + Objects.equals(this.manufacturer, inventoryItem.manufacturer); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, releaseDate, manufacturer); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InventoryItem {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" releaseDate: ").append(toIndentedString(releaseDate)).append("\n"); + sb.append(" manufacturer: ").append(toIndentedString(manufacturer)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/Manufacturer.java b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/Manufacturer.java new file mode 100644 index 00000000..eae2a6f5 --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/java/org/springdoc/demo/app1/sample2/Manufacturer.java @@ -0,0 +1,148 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package org.springdoc.demo.app1.sample2; + +import java.util.Objects; + +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; + +import org.springframework.validation.annotation.Validated; + + +/** + * Manufacturer + */ +@Validated +@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-08T09:37:36.546Z[GMT]") +public class Manufacturer { + @JsonProperty("name") + private String name = null; + + @JsonProperty("homePage") + private String homePage = null; + + @JsonProperty("phone") + private String phone = null; + + public Manufacturer name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + **/ + @Schema(example = "ACME Corporation", required = true) + @NotNull + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Manufacturer homePage(String homePage) { + this.homePage = homePage; + return this; + } + + /** + * Get homePage + * + * @return homePage + **/ + @Schema(example = "https://www.acme-corp.com") + + public String getHomePage() { + return homePage; + } + + public void setHomePage(String homePage) { + this.homePage = homePage; + } + + public Manufacturer phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * + * @return phone + **/ + @Schema(example = "408-867-5309") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Manufacturer manufacturer = (Manufacturer) o; + return Objects.equals(this.name, manufacturer.name) && + Objects.equals(this.homePage, manufacturer.homePage) && + Objects.equals(this.phone, manufacturer.phone); + } + + @Override + public int hashCode() { + return Objects.hash(name, homePage, phone); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Manufacturer {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" homePage: ").append(toIndentedString(homePage)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/springdoc-openapi-spring-boot-1/src/main/resources/application.yml b/springdoc-openapi-spring-boot-1/src/main/resources/application.yml new file mode 100644 index 00000000..2c295b0a --- /dev/null +++ b/springdoc-openapi-spring-boot-1/src/main/resources/application.yml @@ -0,0 +1,20 @@ +server: + use-forward-headers: true + contextPath: / + compression: + enabled: true + mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json + min-response-size: 1024 + http2: + enabled: true +springdoc: + version: '@springdoc.version@' + api-docs: + enabled: true + path: /v3/api-docs + swagger-ui: + path: /swagger-ui.html + tagsSorter: alpha + use-root-path: true + cache: + disabled: true diff --git a/demo-spring-hateoas/.gitignore b/springdoc-openapi-spring-boot-2-webflux-functional/.gitignore similarity index 100% rename from demo-spring-hateoas/.gitignore rename to springdoc-openapi-spring-boot-2-webflux-functional/.gitignore diff --git a/demo-spring-boot-3-webflux-functional/pom.xml b/springdoc-openapi-spring-boot-2-webflux-functional/pom.xml similarity index 74% rename from demo-spring-boot-3-webflux-functional/pom.xml rename to springdoc-openapi-spring-boot-2-webflux-functional/pom.xml index a30d5616..3faf7e4e 100644 --- a/demo-spring-boot-3-webflux-functional/pom.xml +++ b/springdoc-openapi-spring-boot-2-webflux-functional/pom.xml @@ -6,15 +6,15 @@ springdoc-openapi-demos org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT - demo-spring-boot-3-webflux-functional + springdoc-openapi-spring-boot-2-webflux-functional org.springdoc - springdoc-openapi-starter-webflux-ui + springdoc-openapi-webflux-ui @@ -45,5 +45,16 @@ true - + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/WebfluxFunctionalDemoApplication.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/WebfluxFunctionalDemoApplication.java similarity index 89% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/WebfluxFunctionalDemoApplication.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/WebfluxFunctionalDemoApplication.java index 4a109ec6..838c7a6d 100644 --- a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/WebfluxFunctionalDemoApplication.java +++ b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/WebfluxFunctionalDemoApplication.java @@ -19,7 +19,7 @@ package org.springdoc.demo.app4; import io.swagger.v3.oas.models.info.Info; -import org.springdoc.core.models.GroupedOpenApi; +import org.springdoc.core.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -37,7 +37,7 @@ public static void main(String[] args) { public GroupedOpenApi employeesOpenApi(@Value("${springdoc.version}") String appVersion) { String[] paths = { "/employees/**" }; return GroupedOpenApi.builder().group("employees") - .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("Employees API").version(appVersion))) + .addOpenApiCustomiser(openApi -> openApi.info(new Info().title("Employees API").version(appVersion))) .pathsToMatch(paths) .build(); } @@ -46,7 +46,7 @@ public GroupedOpenApi employeesOpenApi(@Value("${springdoc.version}") String app public GroupedOpenApi userOpenApi(@Value("${springdoc.version}") String appVersion) { String[] paths = { "/api/user/**" }; return GroupedOpenApi.builder().group("users") - .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("Users API").version(appVersion))) + .addOpenApiCustomiser(openApi -> openApi.info(new Info().title("Users API").version(appVersion))) .pathsToMatch(paths) .build(); } @@ -55,7 +55,7 @@ public GroupedOpenApi userOpenApi(@Value("${springdoc.version}") String appVersi public GroupedOpenApi coffeeOpenApi(@Value("${springdoc.version}") String appVersion) { String[] paths = { "/coffees/**" }; return GroupedOpenApi.builder().group("coffees") - .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("Coffees API").version(appVersion))) + .addOpenApiCustomiser(openApi -> openApi.info(new Info().title("Coffees API").version(appVersion))) .pathsToMatch(paths) .build(); } diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/Coffee.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/Coffee.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/Coffee.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/Coffee.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeOrder.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeOrder.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeOrder.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeOrder.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeRepository.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeRepository.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeRepository.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeRepository.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeService.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeService.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeService.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/CoffeeService.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/RouteConfig.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/RouteConfig.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/RouteConfig.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/coffee/RouteConfig.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/Employee.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/Employee.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/Employee.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/Employee.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/EmployeeFunctionalConfig.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/EmployeeFunctionalConfig.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/EmployeeFunctionalConfig.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/EmployeeFunctionalConfig.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/EmployeeRepository.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/EmployeeRepository.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/EmployeeRepository.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/employee/EmployeeRepository.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/RoutingConfiguration.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/RoutingConfiguration.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/RoutingConfiguration.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/RoutingConfiguration.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/User.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/User.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/User.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/User.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserHandler.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserHandler.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserHandler.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserHandler.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepository.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepository.java similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepository.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepository.java diff --git a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepositoryImpl.java b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepositoryImpl.java similarity index 97% rename from demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepositoryImpl.java rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepositoryImpl.java index 54768be1..68d00459 100644 --- a/demo-spring-boot-3-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepositoryImpl.java +++ b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/java/org/springdoc/demo/app4/user/UserRepositoryImpl.java @@ -4,7 +4,8 @@ import java.util.Map; import java.util.stream.Collectors; -import jakarta.annotation.PostConstruct; +import javax.annotation.PostConstruct; + import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; diff --git a/demo-spring-boot-3-webflux-functional/src/main/resources/application.yml b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/resources/application.yml similarity index 87% rename from demo-spring-boot-3-webflux-functional/src/main/resources/application.yml rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/resources/application.yml index c0e9a92d..62b2ea08 100644 --- a/demo-spring-boot-3-webflux-functional/src/main/resources/application.yml +++ b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/resources/application.yml @@ -1,4 +1,5 @@ server: + forward-headers-strategy: framework servlet: context-path: / compression: @@ -7,11 +8,7 @@ server: min-response-size: 1024 http2: enabled: true - port: 8084 - forward-headers-strategy: framework springdoc: version: '@springdoc.version@' - api-docs: - version: openapi_3_1 swagger-ui: use-root-path: true \ No newline at end of file diff --git a/demo-spring-boot-3-webflux-functional/src/main/resources/logback-spring.xml b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/resources/logback-spring.xml similarity index 90% rename from demo-spring-boot-3-webflux-functional/src/main/resources/logback-spring.xml rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/resources/logback-spring.xml index f8d92bd4..f9786579 100644 --- a/demo-spring-boot-3-webflux-functional/src/main/resources/logback-spring.xml +++ b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/resources/logback-spring.xml @@ -14,10 +14,10 @@ - - - - + + + + diff --git a/demo-spring-boot-3-webflux-functional/src/main/resources/schema.sql b/springdoc-openapi-spring-boot-2-webflux-functional/src/main/resources/schema.sql similarity index 100% rename from demo-spring-boot-3-webflux-functional/src/main/resources/schema.sql rename to springdoc-openapi-spring-boot-2-webflux-functional/src/main/resources/schema.sql diff --git a/demo-spring-cloud-function/spring-cloud-function-webflux/.gitignore b/springdoc-openapi-spring-boot-2-webflux/.gitignore similarity index 94% rename from demo-spring-cloud-function/spring-cloud-function-webflux/.gitignore rename to springdoc-openapi-spring-boot-2-webflux/.gitignore index 46f1171d..ab21548c 100644 --- a/demo-spring-cloud-function/spring-cloud-function-webflux/.gitignore +++ b/springdoc-openapi-spring-boot-2-webflux/.gitignore @@ -141,9 +141,4 @@ Desktop.ini ###################### # ESLint ###################### -.eslintcache -# Ignore Gradle project-specific cache directory -.gradle - -# Ignore Gradle build output directory -build +.eslintcache \ No newline at end of file diff --git a/demo-spring-boot-3-webflux/README.md b/springdoc-openapi-spring-boot-2-webflux/README.md similarity index 79% rename from demo-spring-boot-3-webflux/README.md rename to springdoc-openapi-spring-boot-2-webflux/README.md index 78e1049f..3f63567d 100644 --- a/demo-spring-boot-3-webflux/README.md +++ b/springdoc-openapi-spring-boot-2-webflux/README.md @@ -24,14 +24,6 @@ To create a non-native OCI docker image, simply run: mvn clean spring-boot:build-image ``` -### Option 3: Building native image with GraalVM - -To create a `native image`, Run the following command - -```sh -mvn -Pnative clean native:compile -``` - ## Running the native application To run the demo using docker, invoke the following: diff --git a/demo-spring-boot-3-webflux/pom.xml b/springdoc-openapi-spring-boot-2-webflux/pom.xml similarity index 74% rename from demo-spring-boot-3-webflux/pom.xml rename to springdoc-openapi-spring-boot-2-webflux/pom.xml index ec279fba..e94f5caa 100644 --- a/demo-spring-boot-3-webflux/pom.xml +++ b/springdoc-openapi-spring-boot-2-webflux/pom.xml @@ -5,15 +5,15 @@ org.springdoc springdoc-openapi-demos - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT - demo-spring-boot-3-webflux + springdoc-openapi-spring-boot-2-webflux org.springdoc - springdoc-openapi-starter-webflux-ui + springdoc-openapi-webflux-ui @@ -45,5 +45,16 @@ true - + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/WebfluxDemoApplication.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/WebfluxDemoApplication.java similarity index 90% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/WebfluxDemoApplication.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/WebfluxDemoApplication.java index 5c14819c..b4fe7829 100644 --- a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/WebfluxDemoApplication.java +++ b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/WebfluxDemoApplication.java @@ -19,7 +19,7 @@ package org.springdoc.demo.app3; import io.swagger.v3.oas.models.info.Info; -import org.springdoc.core.models.GroupedOpenApi; +import org.springdoc.core.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -38,7 +38,7 @@ public GroupedOpenApi tweetsOpenApi(@Value("${springdoc.version}") String appVer String[] paths = { "/tweets/**" }; return GroupedOpenApi.builder(). group("tweets") - .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("Tweets API").version(appVersion))) + .addOpenApiCustomiser(openApi -> openApi.info(new Info().title("Tweets API").version(appVersion))) .pathsToMatch(paths) .build(); } @@ -48,7 +48,7 @@ public GroupedOpenApi streamOpenApi(@Value("${springdoc.version}") String appVer String[] paths = { "/stream/**" }; String[] packagedToMatch = { "org.springdoc.demo.app3" }; return GroupedOpenApi.builder().group("x-stream") - .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("Stream API").version(appVersion))) + .addOpenApiCustomiser(openApi -> openApi.info(new Info().title("Stream API").version(appVersion))) .pathsToMatch(paths).packagesToScan(packagedToMatch) .build(); } diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/controller/ExceptionTranslator.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/controller/ExceptionTranslator.java similarity index 100% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/controller/ExceptionTranslator.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/controller/ExceptionTranslator.java diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetController.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetController.java similarity index 99% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetController.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetController.java index 42df7003..e13fb3b8 100644 --- a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetController.java +++ b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetController.java @@ -18,10 +18,11 @@ package org.springdoc.demo.app3.controller; +import javax.validation.Valid; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; -import jakarta.validation.Valid; import org.springdoc.demo.app3.dto.TweetDTO; import org.springdoc.demo.app3.model.Tweet; import org.springdoc.demo.app3.repository.TweetRepository; diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetMapper.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetMapper.java similarity index 100% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetMapper.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/controller/TweetMapper.java diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/dto/TweetDTO.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/dto/TweetDTO.java similarity index 90% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/dto/TweetDTO.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/dto/TweetDTO.java index e8be17b0..b01d26e9 100644 --- a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/dto/TweetDTO.java +++ b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/dto/TweetDTO.java @@ -20,9 +20,9 @@ import java.util.Date; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; /** diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/exception/TweetNotFoundException.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/exception/TweetNotFoundException.java similarity index 100% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/exception/TweetNotFoundException.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/exception/TweetNotFoundException.java diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/model/Tweet.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/model/Tweet.java similarity index 90% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/model/Tweet.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/model/Tweet.java index a0ae9f53..59aea250 100644 --- a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/model/Tweet.java +++ b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/model/Tweet.java @@ -20,9 +20,9 @@ import java.time.LocalDate; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import org.springframework.data.annotation.Id; diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/payload/ErrorResponse.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/payload/ErrorResponse.java similarity index 100% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/payload/ErrorResponse.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/payload/ErrorResponse.java diff --git a/demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/repository/TweetRepository.java b/springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/repository/TweetRepository.java similarity index 100% rename from demo-spring-boot-3-webflux/src/main/java/org/springdoc/demo/app3/repository/TweetRepository.java rename to springdoc-openapi-spring-boot-2-webflux/src/main/java/org/springdoc/demo/app3/repository/TweetRepository.java diff --git a/demo-spring-boot-3-webflux/src/main/resources/META-INF/native-image/reflect-config.json b/springdoc-openapi-spring-boot-2-webflux/src/main/resources/META-INF/native-image/reflect-config.json similarity index 100% rename from demo-spring-boot-3-webflux/src/main/resources/META-INF/native-image/reflect-config.json rename to springdoc-openapi-spring-boot-2-webflux/src/main/resources/META-INF/native-image/reflect-config.json diff --git a/demo-spring-boot-3-webflux/src/main/resources/application.yml b/springdoc-openapi-spring-boot-2-webflux/src/main/resources/application.yml similarity index 80% rename from demo-spring-boot-3-webflux/src/main/resources/application.yml rename to springdoc-openapi-spring-boot-2-webflux/src/main/resources/application.yml index bbeb187b..12f66b4e 100644 --- a/demo-spring-boot-3-webflux/src/main/resources/application.yml +++ b/springdoc-openapi-spring-boot-2-webflux/src/main/resources/application.yml @@ -1,17 +1,13 @@ server: - servlet: - context-path: / compression: enabled: true mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json min-response-size: 1024 http2: enabled: true - port: 8082 + port: 8080 forward-headers-strategy: framework springdoc: version: '@springdoc.version@' - api-docs: - version: openapi_3_1 swagger-ui: use-root-path: true \ No newline at end of file diff --git a/demo-spring-boot-3-webflux/src/main/resources/schema.sql b/springdoc-openapi-spring-boot-2-webflux/src/main/resources/schema.sql similarity index 100% rename from demo-spring-boot-3-webflux/src/main/resources/schema.sql rename to springdoc-openapi-spring-boot-2-webflux/src/main/resources/schema.sql diff --git a/demo-spring-boot-3-webmvc/.gitignore b/springdoc-openapi-spring-boot-2-webmvc/.gitignore similarity index 100% rename from demo-spring-boot-3-webmvc/.gitignore rename to springdoc-openapi-spring-boot-2-webmvc/.gitignore diff --git a/demo-spring-boot-3-webmvc/README.md b/springdoc-openapi-spring-boot-2-webmvc/README.md similarity index 79% rename from demo-spring-boot-3-webmvc/README.md rename to springdoc-openapi-spring-boot-2-webmvc/README.md index 71dce5dd..abf16b4e 100644 --- a/demo-spring-boot-3-webmvc/README.md +++ b/springdoc-openapi-spring-boot-2-webmvc/README.md @@ -24,14 +24,6 @@ To create a non-native OCI docker image, simply run: mvn clean spring-boot:build-image ``` -### Option 3: Building native image with GraalVM - -To create a `native image`, Run the following command - -```sh -mvn -Pnative clean native:compile -``` - ## Running the native application To run the demo using docker, invoke the following: diff --git a/demo-spring-boot-3-webmvc/pom.xml b/springdoc-openapi-spring-boot-2-webmvc/pom.xml similarity index 72% rename from demo-spring-boot-3-webmvc/pom.xml rename to springdoc-openapi-spring-boot-2-webmvc/pom.xml index fdd43092..252cb42a 100644 --- a/demo-spring-boot-3-webmvc/pom.xml +++ b/springdoc-openapi-spring-boot-2-webmvc/pom.xml @@ -5,9 +5,9 @@ org.springdoc springdoc-openapi-demos - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT - demo-spring-boot-3-webmvc + springdoc-openapi-spring-boot-2-webmvc @@ -29,7 +29,7 @@ org.springdoc - springdoc-openapi-starter-webmvc-ui + springdoc-openapi-ui org.springframework.boot @@ -37,5 +37,16 @@ true - + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/Application.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/Application.java similarity index 81% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/Application.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/Application.java index 54419920..cc346085 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/Application.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/Application.java @@ -20,9 +20,9 @@ import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.security.SecurityRequirement; -import org.springdoc.core.customizers.OpenApiCustomizer; +import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.customizers.OpenApiCustomiser; import org.springdoc.core.customizers.OperationCustomizer; -import org.springdoc.core.models.GroupedOpenApi; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; @@ -31,8 +31,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Profile; -import static org.springdoc.core.utils.Constants.ALL_PATTERN; - +import static org.springdoc.core.Constants.ALL_PATTERN; @SpringBootApplication public class Application { @@ -43,17 +42,18 @@ public static void main(String[] args) { @Bean @Profile("!prod") - public GroupedOpenApi actuatorApi(OpenApiCustomizer actuatorOpenApiCustomiser, + public GroupedOpenApi actuatorApi(OpenApiCustomiser actuatorOpenApiCustomiser, OperationCustomizer actuatorCustomizer, WebEndpointProperties endpointProperties, @Value("${springdoc.version}") String appVersion) { return GroupedOpenApi.builder() .group("Actuator") .pathsToMatch(endpointProperties.getBasePath() + ALL_PATTERN) - .addOpenApiCustomizer(actuatorOpenApiCustomiser) - .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("Actuator API").version(appVersion))) + .addOpenApiCustomiser(actuatorOpenApiCustomiser) + .addOpenApiCustomiser(openApi -> openApi.info(new Info().title("Actuator API").version(appVersion))) .addOperationCustomizer(actuatorCustomizer) - .pathsToExclude("/health/*") + .pathsToExclude("/rest/actuator/health/**") + .pathsToExclude("/rest/actuator/health/*") .build(); } @@ -64,7 +64,7 @@ public GroupedOpenApi usersGroup(@Value("${springdoc.version}") String appVersio operation.addSecurityItem(new SecurityRequirement().addList("basicScheme")); return operation; }) - .addOpenApiCustomizer(openApi -> openApi.info(new Info().title("Users API").version(appVersion))) + .addOpenApiCustomiser(openApi -> openApi.info(new Info().title("Users API").version(appVersion))) .packagesToScan("org.springdoc.demo.app2") .build(); } diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/ApiUtil.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/ApiUtil.java similarity index 96% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/ApiUtil.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/ApiUtil.java index 21de960e..8ef22656 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/ApiUtil.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/ApiUtil.java @@ -20,7 +20,7 @@ import java.io.IOException; -import jakarta.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.web.context.request.NativeWebRequest; diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/ExceptionTranslator.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/ExceptionTranslator.java similarity index 90% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/ExceptionTranslator.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/ExceptionTranslator.java index 1c695cb5..f046a377 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/ExceptionTranslator.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/ExceptionTranslator.java @@ -20,7 +20,7 @@ import java.util.Map; -import jakarta.validation.ConstraintViolationException; +import javax.validation.ConstraintViolationException; import org.springframework.boot.web.error.ErrorAttributeOptions; import org.springframework.boot.web.servlet.error.ErrorAttributes; @@ -43,7 +43,7 @@ public ExceptionTranslator(ErrorAttributes errorAttributes) { @ExceptionHandler(ConstraintViolationException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) public Map processConstraintViolationException(WebRequest request) { - request.setAttribute("jakarta.servlet.error.status_code", HttpStatus.BAD_REQUEST.value(), RequestAttributes.SCOPE_REQUEST); + request.setAttribute("javax.servlet.error.status_code", HttpStatus.BAD_REQUEST.value(), RequestAttributes.SCOPE_REQUEST); return errorAttributes.getErrorAttributes(request, ErrorAttributeOptions.defaults()); } } diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApi.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApi.java similarity index 95% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApi.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApi.java index 4b19aae7..1eac2c2f 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApi.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApi.java @@ -25,6 +25,9 @@ import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.Explode; @@ -42,9 +45,6 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.security.SecurityScheme; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; -import org.springdoc.core.annotations.ParameterObject; import org.springdoc.demo.app2.model.ModelApiResponse; import org.springdoc.demo.app2.model.Pet; @@ -161,11 +161,11 @@ default ResponseEntity updatePetWithForm( @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class))) }) @PostMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { - "application/octet-stream" }) + "multipart/form-data" }) default ResponseEntity uploadFile( @Parameter(description = "ID of pet to update", required = true) @PathVariable("petId") Long petId, @Parameter(description = "Additional Metadata") @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata, - @io.swagger.v3.oas.annotations.parameters.RequestBody(content = @Content(mediaType = "application/octet-stream", schema = @Schema(type = "string", format = "binary"))) @Valid @RequestPart("file") MultipartFile file) { + @Parameter(content = @Content(mediaType = "multipart/form-data", schema = @Schema(type = "string", format = "binary"))) @Valid @RequestPart("file") MultipartFile file) { return getDelegate().uploadFile(petId, additionalMetadata, file); } @@ -175,7 +175,7 @@ default ResponseEntity uploadFile( @ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))) }) @GetMapping(value = "/pet", produces = { "application/xml", "application/json" }) - default ResponseEntity> getAllPets(@NotNull @ParameterObject Pageable pageable) { + default ResponseEntity> getAllPets(@NotNull Pageable pageable) { return getDelegate().getAllPets(pageable); } diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiController.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiController.java similarity index 89% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiController.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiController.java index b2b93ac9..5aee62ac 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiController.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiController.java @@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]") + @RestController @RequestMapping("${openapi.openAPIPetstore.base-path:/}") public class PetApiController implements PetApi { diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegate.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegate.java similarity index 94% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegate.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegate.java index 98e0e43d..d6094f44 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegate.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegate.java @@ -21,8 +21,9 @@ import java.util.List; import java.util.Optional; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + import org.springdoc.demo.app2.model.ModelApiResponse; import org.springdoc.demo.app2.model.Pet; @@ -37,6 +38,7 @@ * A delegate to be called by the {@link PetApiController}}. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. */ +@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]") public interface PetApiDelegate { diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegateImpl.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegateImpl.java similarity index 98% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegateImpl.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegateImpl.java index 7d7565a7..f89307b2 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegateImpl.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/PetApiDelegateImpl.java @@ -26,8 +26,9 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; -import jakarta.annotation.PostConstruct; -import jakarta.validation.constraints.NotNull; +import javax.annotation.PostConstruct; +import javax.validation.constraints.NotNull; + import org.apache.tomcat.util.http.fileupload.IOUtils; import org.springdoc.demo.app2.model.Category; import org.springdoc.demo.app2.model.ModelApiResponse; @@ -72,7 +73,7 @@ private static Pet createPet(long id, Category category, String name, String[] u } @PostConstruct - public void initPets() { + private void initPets() { Category dogs = new Category().id(1L).name("Dogs"); Category cats = new Category().id(2L).name("Cats"); Category rabbits = new Category().id(3L).name("Rabbits"); diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApi.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApi.java similarity index 94% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApi.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApi.java index b85c9565..db012294 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApi.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApi.java @@ -25,6 +25,10 @@ import java.util.Map; +import javax.validation.Valid; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -33,9 +37,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import jakarta.validation.constraints.Max; -import jakarta.validation.constraints.Min; import org.springdoc.demo.app2.model.Order; import org.springframework.http.ResponseEntity; @@ -45,6 +46,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]") + @Tag(name = "store", description = "the store API") public interface StoreApi { diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiController.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiController.java similarity index 89% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiController.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiController.java index d7dea64c..bf4883ae 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiController.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiController.java @@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]") + @RestController @RequestMapping("${openapi.openAPIPetstore.base-path:/}") public class StoreApiController implements StoreApi { diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegate.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegate.java similarity index 94% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegate.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegate.java index 546077ba..b1e89665 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegate.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegate.java @@ -32,6 +32,8 @@ * A delegate to be called by the {@link StoreApiController}}. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. */ +@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]") + public interface StoreApiDelegate { default Optional getRequest() { diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegateImpl.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegateImpl.java similarity index 97% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegateImpl.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegateImpl.java index 65a930e0..e0b2809a 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegateImpl.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/StoreApiDelegateImpl.java @@ -21,7 +21,8 @@ import java.util.Date; import java.util.Map; -import jakarta.annotation.PostConstruct; +import javax.annotation.PostConstruct; + import org.springdoc.demo.app2.model.Order; import org.springdoc.demo.app2.repository.OrderRepository; import org.springdoc.demo.app2.repository.PetRepository; @@ -58,7 +59,7 @@ private static Order createOrder(long id, long petId, Order.StatusEnum status) { } @PostConstruct - public void initOrders() { + void initOrders() { orderRepository.save(createOrder(1, 1, Order.StatusEnum.PLACED)); orderRepository.save(createOrder(2, 1, Order.StatusEnum.DELIVERED)); orderRepository.save(createOrder(3, 2, Order.StatusEnum.PLACED)); diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApi.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApi.java similarity index 97% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApi.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApi.java index 990ce324..2e35103e 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApi.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApi.java @@ -25,6 +25,9 @@ import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; + import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.Explode; @@ -36,8 +39,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; import org.springdoc.demo.app2.model.User; import org.springframework.http.ResponseEntity; @@ -49,6 +50,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]") + @Tag(name = "user", description = "the user API") public interface UserApi { diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiController.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiController.java similarity index 89% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiController.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiController.java index 83438b03..c0f72019 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiController.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiController.java @@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]") + @RestController @RequestMapping("${openapi.openAPIPetstore.base-path:/}") public class UserApiController implements UserApi { diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegate.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegate.java similarity index 95% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegate.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegate.java index 42cdd7e8..cae690c6 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegate.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegate.java @@ -32,6 +32,7 @@ * A delegate to be called by the {@link UserApiController}}. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. */ +@javax.annotation.Generated(value = "org.springdoc.demo.app2.codegen.languages.SpringCodegen", date = "2019-07-11T00:09:29.839+02:00[Europe/Paris]") public interface UserApiDelegate { diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegateImpl.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegateImpl.java similarity index 98% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegateImpl.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegateImpl.java index a36b4f1e..f7003110 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegateImpl.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/api/UserApiDelegateImpl.java @@ -23,7 +23,8 @@ import java.util.Date; import java.util.List; -import jakarta.annotation.PostConstruct; +import javax.annotation.PostConstruct; + import org.springdoc.demo.app2.model.User; import org.springdoc.demo.app2.repository.UserRepository; @@ -54,7 +55,7 @@ private static User createUser(long id, String username, String firstName, Strin } @PostConstruct - public void initUsers() { + private void initUsers() { userRepository.save(createUser(1, "user1", "first name 1", "last name 1", "email1@test.com", 1)); userRepository.save(createUser(2, "user2", "first name 2", "last name 2", diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Body.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Body.java similarity index 100% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Body.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Body.java diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Body1.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Body1.java similarity index 100% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Body1.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Body1.java diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Category.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Category.java similarity index 90% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Category.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Category.java index f78e6a68..58819daa 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Category.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Category.java @@ -20,18 +20,20 @@ import java.util.Objects; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; /** * Category */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-12-02T19:53:02.467132-01:00[Atlantic/Azores]") @JacksonXmlRootElement(localName = "category") @XmlRootElement(name = "category") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/ModelApiResponse.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/ModelApiResponse.java similarity index 92% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/ModelApiResponse.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/ModelApiResponse.java index 9f389fab..3243320e 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/ModelApiResponse.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/ModelApiResponse.java @@ -20,18 +20,20 @@ import java.util.Objects; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; /** * ModelApiResponse */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-12-02T19:53:02.467132-01:00[Atlantic/Azores]") @JacksonXmlRootElement(localName = "##default") @XmlRootElement(name = "##default") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Order.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Order.java similarity index 94% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Order.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Order.java index 7184c730..496d1c04 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Order.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Order.java @@ -21,21 +21,23 @@ import java.util.Date; import java.util.Objects; +import javax.validation.Valid; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.Valid; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; /** * Order */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-12-02T19:53:02.467132-01:00[Atlantic/Azores]") @JacksonXmlRootElement(localName = "order") @XmlRootElement(name = "order") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Pet.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Pet.java similarity index 94% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Pet.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Pet.java index d5420028..604adbbf 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Pet.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Pet.java @@ -23,22 +23,24 @@ import java.util.List; import java.util.Objects; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; /** * Pet */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-12-02T19:53:02.467132-01:00[Atlantic/Azores]") @JacksonXmlRootElement(localName = "pet") @XmlRootElement(name = "pet") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Tag.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Tag.java similarity index 90% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Tag.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Tag.java index 31a6a22f..7b7ab32f 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/Tag.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/Tag.java @@ -20,18 +20,20 @@ import java.util.Objects; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; /** * Tag */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-12-02T19:53:02.467132-01:00[Atlantic/Azores]") @JacksonXmlRootElement(localName = "tag") @XmlRootElement(name = "tag") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/User.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/User.java similarity index 95% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/User.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/User.java index 420d4b23..308df190 100644 --- a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/model/User.java +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/model/User.java @@ -20,18 +20,20 @@ import java.util.Objects; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; + import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; /** * User */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-12-02T19:53:02.467132-01:00[Atlantic/Azores]") @JacksonXmlRootElement(localName = "user") @XmlRootElement(name = "user") @XmlAccessorType(XmlAccessType.FIELD) diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/repository/HashMapRepository.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/repository/HashMapRepository.java similarity index 100% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/repository/HashMapRepository.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/repository/HashMapRepository.java diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/repository/OrderRepository.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/repository/OrderRepository.java similarity index 100% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/repository/OrderRepository.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/repository/OrderRepository.java diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/repository/PetRepository.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/repository/PetRepository.java similarity index 100% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/repository/PetRepository.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/repository/PetRepository.java diff --git a/demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/repository/UserRepository.java b/springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/repository/UserRepository.java similarity index 100% rename from demo-spring-boot-3-webmvc/src/main/java/org/springdoc/demo/app2/repository/UserRepository.java rename to springdoc-openapi-spring-boot-2-webmvc/src/main/java/org/springdoc/demo/app2/repository/UserRepository.java diff --git a/demo-spring-boot-3-webmvc/src/main/resources/application.yml b/springdoc-openapi-spring-boot-2-webmvc/src/main/resources/application.yml similarity index 85% rename from demo-spring-boot-3-webmvc/src/main/resources/application.yml rename to springdoc-openapi-spring-boot-2-webmvc/src/main/resources/application.yml index 377fa891..72d9f019 100644 --- a/demo-spring-boot-3-webmvc/src/main/resources/application.yml +++ b/springdoc-openapi-spring-boot-2-webmvc/src/main/resources/application.yml @@ -7,8 +7,6 @@ management: springdoc: version: '@springdoc.version@' - api-docs: - version: openapi_3_1 swagger-ui: display-request-duration: true groups-order: DESC @@ -19,8 +17,6 @@ springdoc: group-configs: - group: stores paths-to-match: /store/** - cache: - disabled: true server: - port: 8081 + port: 8080 forward-headers-strategy: framework \ No newline at end of file diff --git a/demo-spring-boot-3-webmvc/src/main/resources/petstore.yml b/springdoc-openapi-spring-boot-2-webmvc/src/main/resources/petstore.yml similarity index 100% rename from demo-spring-boot-3-webmvc/src/main/resources/petstore.yml rename to springdoc-openapi-spring-boot-2-webmvc/src/main/resources/petstore.yml diff --git a/demo-spring-cloud-function/.gitignore b/springdoc-openapi-spring-cloud-function/.gitignore similarity index 94% rename from demo-spring-cloud-function/.gitignore rename to springdoc-openapi-spring-cloud-function/.gitignore index 46f1171d..ab21548c 100644 --- a/demo-spring-cloud-function/.gitignore +++ b/springdoc-openapi-spring-cloud-function/.gitignore @@ -141,9 +141,4 @@ Desktop.ini ###################### # ESLint ###################### -.eslintcache -# Ignore Gradle project-specific cache directory -.gradle - -# Ignore Gradle build output directory -build +.eslintcache \ No newline at end of file diff --git a/demo-spring-cloud-function/pom.xml b/springdoc-openapi-spring-cloud-function/pom.xml similarity index 84% rename from demo-spring-cloud-function/pom.xml rename to springdoc-openapi-spring-cloud-function/pom.xml index 2785363c..a93094ad 100644 --- a/demo-spring-cloud-function/pom.xml +++ b/springdoc-openapi-spring-cloud-function/pom.xml @@ -5,13 +5,12 @@ springdoc-openapi-demos org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT 4.0.0 - demo-spring-cloud-function + springdoc-openapi-spring-cloud-function pom - spring-cloud-function-webmvc spring-cloud-function-webflux diff --git a/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/.gitignore b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/.gitignore new file mode 100644 index 00000000..ab21548c --- /dev/null +++ b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/.gitignore @@ -0,0 +1,144 @@ +###################### +# Project Specific +###################### +/target/www/** +/src/test/javascript/coverage/ + +###################### +# Node +###################### +/node/ +node_tmp/ +node_modules/ +npm-debug.log.* +/.awcache/* +/.cache-loader/* + +###################### +# SASS +###################### +.sass-cache/ + +###################### +# Eclipse +###################### +*.pydevproject +.project +.metadata +tmp/ +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +.factorypath +/src/main/resources/rebel.xml + +# External tool builders +.externalToolBuilders/** + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +###################### +# Intellij +###################### +.idea/ +*.iml +*.iws +*.ipr +*.ids +*.orig +classes/ +out/ + +###################### +# Visual Studio Code +###################### +.vscode/ + +###################### +# Maven +###################### +/log/ +/target/ + +###################### +# Gradle +###################### +.gradle/ +/build/ + +###################### +# Package Files +###################### +*.jar +*.war +*.ear +*.db + +###################### +# Windows +###################### +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +###################### +# Mac OSX +###################### +.DS_Store +.svn + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +###################### +# Directories +###################### +/bin/ +/deploy/ + +###################### +# Logs +###################### +*.log* + +###################### +# Others +###################### +*.class +*.*~ +*~ +.merge_file* + +###################### +# Gradle Wrapper +###################### +!gradle/wrapper/gradle-wrapper.jar + +###################### +# Maven Wrapper +###################### +!.mvn/wrapper/maven-wrapper.jar + +###################### +# ESLint +###################### +.eslintcache \ No newline at end of file diff --git a/demo-spring-cloud-function/spring-cloud-function-webflux/pom.xml b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/pom.xml similarity index 59% rename from demo-spring-cloud-function/spring-cloud-function-webflux/pom.xml rename to springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/pom.xml index abb068f8..380aa011 100644 --- a/demo-spring-cloud-function/spring-cloud-function-webflux/pom.xml +++ b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/pom.xml @@ -3,9 +3,9 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - demo-spring-cloud-function + springdoc-openapi-spring-cloud-function org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT 4.0.0 @@ -18,7 +18,19 @@ org.springdoc - springdoc-openapi-starter-webflux-ui + springdoc-openapi-webflux-ui + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/demo-spring-cloud-function/spring-cloud-function-webflux/src/main/java/org/springdoc/demo/services/functions/PersonDTO.java b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/src/main/java/org/springdoc/demo/services/functions/PersonDTO.java similarity index 100% rename from demo-spring-cloud-function/spring-cloud-function-webflux/src/main/java/org/springdoc/demo/services/functions/PersonDTO.java rename to springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/src/main/java/org/springdoc/demo/services/functions/PersonDTO.java diff --git a/demo-spring-cloud-function/spring-cloud-function-webflux/src/main/java/org/springdoc/demo/services/functions/SampleApplication.java b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/src/main/java/org/springdoc/demo/services/functions/SampleApplication.java similarity index 100% rename from demo-spring-cloud-function/spring-cloud-function-webflux/src/main/java/org/springdoc/demo/services/functions/SampleApplication.java rename to springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/src/main/java/org/springdoc/demo/services/functions/SampleApplication.java diff --git a/demo-spring-cloud-function/spring-cloud-function-webflux/src/main/resources/application.yml b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/src/main/resources/application.yml similarity index 54% rename from demo-spring-cloud-function/spring-cloud-function-webflux/src/main/resources/application.yml rename to springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/src/main/resources/application.yml index a773b6ae..4055356c 100644 --- a/demo-spring-cloud-function/spring-cloud-function-webflux/src/main/resources/application.yml +++ b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webflux/src/main/resources/application.yml @@ -1,8 +1,7 @@ +server: + forward-headers-strategy: framework springdoc: version: '@springdoc.version@' - api-docs: - version: openapi_3_1 swagger-ui: use-root-path: true -server: - forward-headers-strategy: framework \ No newline at end of file + \ No newline at end of file diff --git a/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/.gitignore b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/.gitignore new file mode 100644 index 00000000..ab21548c --- /dev/null +++ b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/.gitignore @@ -0,0 +1,144 @@ +###################### +# Project Specific +###################### +/target/www/** +/src/test/javascript/coverage/ + +###################### +# Node +###################### +/node/ +node_tmp/ +node_modules/ +npm-debug.log.* +/.awcache/* +/.cache-loader/* + +###################### +# SASS +###################### +.sass-cache/ + +###################### +# Eclipse +###################### +*.pydevproject +.project +.metadata +tmp/ +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +.factorypath +/src/main/resources/rebel.xml + +# External tool builders +.externalToolBuilders/** + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +###################### +# Intellij +###################### +.idea/ +*.iml +*.iws +*.ipr +*.ids +*.orig +classes/ +out/ + +###################### +# Visual Studio Code +###################### +.vscode/ + +###################### +# Maven +###################### +/log/ +/target/ + +###################### +# Gradle +###################### +.gradle/ +/build/ + +###################### +# Package Files +###################### +*.jar +*.war +*.ear +*.db + +###################### +# Windows +###################### +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +###################### +# Mac OSX +###################### +.DS_Store +.svn + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +###################### +# Directories +###################### +/bin/ +/deploy/ + +###################### +# Logs +###################### +*.log* + +###################### +# Others +###################### +*.class +*.*~ +*~ +.merge_file* + +###################### +# Gradle Wrapper +###################### +!gradle/wrapper/gradle-wrapper.jar + +###################### +# Maven Wrapper +###################### +!.mvn/wrapper/maven-wrapper.jar + +###################### +# ESLint +###################### +.eslintcache \ No newline at end of file diff --git a/demo-spring-cloud-function/spring-cloud-function-webmvc/pom.xml b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/pom.xml similarity index 59% rename from demo-spring-cloud-function/spring-cloud-function-webmvc/pom.xml rename to springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/pom.xml index f857898d..b9149c75 100644 --- a/demo-spring-cloud-function/spring-cloud-function-webmvc/pom.xml +++ b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/pom.xml @@ -3,9 +3,9 @@ xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - demo-spring-cloud-function + springdoc-openapi-spring-cloud-function org.springdoc - 3.1.7-SNAPSHOT + 3.1.6-SNAPSHOT 4.0.0 @@ -18,7 +18,19 @@ org.springdoc - springdoc-openapi-starter-webmvc-ui + springdoc-openapi-ui + + + + org.springdoc + springdoc-openapi-maven-plugin + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/demo-spring-cloud-function/spring-cloud-function-webmvc/src/main/java/org/springdoc/demo/services/functions/PersonDTO.java b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/src/main/java/org/springdoc/demo/services/functions/PersonDTO.java similarity index 100% rename from demo-spring-cloud-function/spring-cloud-function-webmvc/src/main/java/org/springdoc/demo/services/functions/PersonDTO.java rename to springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/src/main/java/org/springdoc/demo/services/functions/PersonDTO.java diff --git a/demo-spring-cloud-function/spring-cloud-function-webmvc/src/main/java/org/springdoc/demo/services/functions/SampleApplication.java b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/src/main/java/org/springdoc/demo/services/functions/SampleApplication.java similarity index 100% rename from demo-spring-cloud-function/spring-cloud-function-webmvc/src/main/java/org/springdoc/demo/services/functions/SampleApplication.java rename to springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/src/main/java/org/springdoc/demo/services/functions/SampleApplication.java diff --git a/demo-book-service/src/main/resources/application.yml b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/src/main/resources/application.yml similarity index 76% rename from demo-book-service/src/main/resources/application.yml rename to springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/src/main/resources/application.yml index a5984bfc..3c53747e 100644 --- a/demo-book-service/src/main/resources/application.yml +++ b/springdoc-openapi-spring-cloud-function/spring-cloud-function-webmvc/src/main/resources/application.yml @@ -1,9 +1,6 @@ server: forward-headers-strategy: framework - springdoc: - api-docs: - version: openapi_3_1 version: '@springdoc.version@' swagger-ui: use-root-path: true \ No newline at end of file