From dab806fb0b138eac07c31923629553b46d08aedb Mon Sep 17 00:00:00 2001 From: nashtech-huyphamphu Date: Thu, 29 Aug 2024 16:20:38 +0700 Subject: [PATCH 1/7] #882 Create a shared project --- .github/workflows/cart-ci.yaml | 6 +- .github/workflows/customer-ci.yaml | 6 +- .github/workflows/inventory-ci.yaml | 6 +- .github/workflows/location-ci.yaml | 6 +- .github/workflows/product-ci.yaml | 4 +- cart/pom.xml | 8 +- .../com/yas/cart/service/CartServiceIT.java | 30 +- cart/src/it/resources/application.properties | 3 - cart/src/it/resources/test-realm.json | 3988 +++++++++-------- .../java/com/yas/cart/config/CorsConfig.java | 2 +- .../com/yas/cart/config/SwaggerConfig.java | 7 +- .../cart/exception/ApiExceptionHandler.java | 2 + .../cart/exception/BadRequestException.java | 20 - .../yas/cart/exception/NotFoundException.java | 21 - .../com/yas/cart/service/CartService.java | 4 +- .../com/yas/cart/utils/MessagesUtils.java | 24 - .../com/yas/cart/viewmodel/CartDetailVm.java | 6 +- .../com/yas/cart/viewmodel/CartPostVm.java | 2 +- .../yas/cart/viewmodel/ResponeStatusVm.java | 2 +- .../src/main/resources/application.properties | 17 +- cart/src/main/resources/logback-spring.xml | 44 +- .../resources/messages/messages.properties | 14 +- .../cart/controller/CartControllerTest.java | 50 +- .../yas/cart/service/ProductServiceTest.java | 3 +- .../src/test/resources/application.properties | 3 - cart/src/test/resources/logback-spring.xml | 2 +- common-library/pom.xml | 55 + .../CommonLibraryApplication.java | 15 + .../config/ServiceUrlConfig.java | 7 + .../commonlibrary/constants/ApiConstant.java | 23 + .../commonlibrary/constants/MessageCode.java | 10 + .../constants/PageableConstant.java | 9 + .../exception/AccessDeniedException.java | 2 +- .../exception/BadRequestException.java | 4 +- .../exception/CreateGuestUserException.java | 7 + .../exception/DuplicatedException.java | 4 +- .../InternalServerErrorException.java | 4 +- .../exception/NotFoundException.java | 6 +- .../exception/StockExistingException.java | 4 +- .../exception/WrongEmailFormatException.java | 4 +- .../utils/AuthenticationUtils.java | 31 + .../commonlibrary}/utils/MessagesUtils.java | 9 +- .../viewmodel/error/ErrorVm.java | 11 + .../src/main/resources/application.properties | 6 + .../src/main/resources/logback-spring.xml | 27 + .../resources/messages/messages.properties | 43 + .../src/test/resources/application.properties | 14 + customer/pom.xml | 5 + .../service/UserAddressServiceIT.java | 4 +- .../exception/AccessDeniedException.java | 8 - .../exception/ApiExceptionHandler.java | 4 + .../exception/CreateGuestUserException.java | 7 - .../customer/exception/NotFoundException.java | 20 - .../yas/customer/service/CustomerService.java | 6 +- .../customer/service/UserAddressService.java | 4 +- .../customer/service/CustomerServiceTest.java | 6 +- inventory/pom.xml | 5 + .../yas/inventory/service/StockServiceIT.java | 6 +- .../inventory/service/WarehouseServiceIT.java | 4 +- .../exception/ApiExceptionHandler.java | 1 + .../exception/BadRequestException.java | 21 - .../exception/DuplicatedException.java | 21 - .../yas/inventory/service/StockService.java | 6 +- .../inventory/service/WarehouseService.java | 4 +- .../inventory/utils/AuthenticationUtils.java | 2 +- location/pom.xml | 5 + .../exception/ApiExceptionHandler.java | 3 + .../exception/BadRequestException.java | 21 - .../location/exception/NotFoundException.java | 22 - .../yas/location/service/AddressService.java | 2 +- .../yas/location/service/CountryService.java | 4 +- .../service/StateOrProvinceService.java | 4 +- .../location/service/AddressServiceTest.java | 2 +- .../location/service/CountryServiceTest.java | 4 +- .../service/StateOrProvinceServiceTest.java | 4 +- pom.xml | 1 + product/pom.xml | 5 + .../product/controller/BrandController.java | 3 +- .../controller/CategoryController.java | 2 +- .../ProductAttributeController.java | 4 +- .../ProductAttributeGroupController.java | 2 +- .../ProductAttributeValueController.java | 4 +- .../controller/ProductOptionController.java | 2 +- .../ProductOptionValueController.java | 2 +- .../exception/ApiExceptionHandler.java | 4 + .../exception/DuplicatedException.java | 21 - .../product/exception/NotFoundException.java | 21 - .../com/yas/product/service/BrandService.java | 6 +- .../yas/product/service/CategoryService.java | 6 +- .../service/ProductAttributeGroupService.java | 2 +- .../service/ProductAttributeService.java | 6 +- .../product/service/ProductOptionService.java | 4 +- .../yas/product/service/ProductService.java | 8 +- .../service/ProductTemplateService.java | 6 +- .../ProductTemplateControllerTest.java | 2 +- .../yas/product/service/BrandServiceTest.java | 4 +- .../ProductAttributeGroupServiceTest.java | 2 +- .../service/ProductAttributeServiceTest.java | 2 +- .../service/ProductOptionServiceTest.java | 4 +- .../product/service/ProductServiceTest.java | 2 +- .../service/ProductTemplateServiceTest.java | 6 +- 101 files changed, 2689 insertions(+), 2222 deletions(-) delete mode 100644 cart/src/main/java/com/yas/cart/exception/BadRequestException.java delete mode 100644 cart/src/main/java/com/yas/cart/exception/NotFoundException.java delete mode 100644 cart/src/main/java/com/yas/cart/utils/MessagesUtils.java create mode 100644 common-library/pom.xml create mode 100644 common-library/src/main/java/com/yas/commonlibrary/CommonLibraryApplication.java create mode 100644 common-library/src/main/java/com/yas/commonlibrary/config/ServiceUrlConfig.java create mode 100644 common-library/src/main/java/com/yas/commonlibrary/constants/ApiConstant.java create mode 100644 common-library/src/main/java/com/yas/commonlibrary/constants/MessageCode.java create mode 100644 common-library/src/main/java/com/yas/commonlibrary/constants/PageableConstant.java rename {inventory/src/main/java/com/yas/inventory => common-library/src/main/java/com/yas/commonlibrary}/exception/AccessDeniedException.java (78%) rename {product/src/main/java/com/yas/product => common-library/src/main/java/com/yas/commonlibrary}/exception/BadRequestException.java (84%) create mode 100644 common-library/src/main/java/com/yas/commonlibrary/exception/CreateGuestUserException.java rename {location/src/main/java/com/yas/location => common-library/src/main/java/com/yas/commonlibrary}/exception/DuplicatedException.java (81%) rename {product/src/main/java/com/yas/product => common-library/src/main/java/com/yas/commonlibrary}/exception/InternalServerErrorException.java (78%) rename {inventory/src/main/java/com/yas/inventory => common-library/src/main/java/com/yas/commonlibrary}/exception/NotFoundException.java (81%) rename {inventory/src/main/java/com/yas/inventory => common-library/src/main/java/com/yas/commonlibrary}/exception/StockExistingException.java (81%) rename {customer/src/main/java/com/yas/customer => common-library/src/main/java/com/yas/commonlibrary}/exception/WrongEmailFormatException.java (81%) create mode 100644 common-library/src/main/java/com/yas/commonlibrary/utils/AuthenticationUtils.java rename {inventory/src/main/java/com/yas/inventory => common-library/src/main/java/com/yas/commonlibrary}/utils/MessagesUtils.java (78%) create mode 100644 common-library/src/main/java/com/yas/commonlibrary/viewmodel/error/ErrorVm.java create mode 100644 common-library/src/main/resources/application.properties create mode 100644 common-library/src/main/resources/logback-spring.xml create mode 100644 common-library/src/main/resources/messages/messages.properties create mode 100644 common-library/src/test/resources/application.properties delete mode 100644 customer/src/main/java/com/yas/customer/exception/AccessDeniedException.java delete mode 100644 customer/src/main/java/com/yas/customer/exception/CreateGuestUserException.java delete mode 100644 customer/src/main/java/com/yas/customer/exception/NotFoundException.java delete mode 100644 inventory/src/main/java/com/yas/inventory/exception/BadRequestException.java delete mode 100644 inventory/src/main/java/com/yas/inventory/exception/DuplicatedException.java delete mode 100644 location/src/main/java/com/yas/location/exception/BadRequestException.java delete mode 100644 location/src/main/java/com/yas/location/exception/NotFoundException.java delete mode 100644 product/src/main/java/com/yas/product/exception/DuplicatedException.java delete mode 100644 product/src/main/java/com/yas/product/exception/NotFoundException.java diff --git a/.github/workflows/cart-ci.yaml b/.github/workflows/cart-ci.yaml index bb7457d3d5..59f0045fa6 100644 --- a/.github/workflows/cart-ci.yaml +++ b/.github/workflows/cart-ci.yaml @@ -27,16 +27,16 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - uses: ./.github/workflows/actions + - name: Run Maven Build Command + run: mvn clean install -pl cart -am - name: Run Maven Checkstyle if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} - run: mvn checkstyle:checkstyle -f cart -Dcheckstyle.output.file=cart-checkstyle-result.xml + run: mvn checkstyle:checkstyle -pl cart -am -Dcheckstyle.output.file=cart-checkstyle-result.xml - name: Upload Checkstyle Result if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} uses: jwgmeligmeyling/checkstyle-github-action@master with: path: '**/cart-checkstyle-result.xml' - - name: Run Maven Verify - run: mvn clean verify -f cart - name: Test Results uses: dorny/test-reporter@v1 if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} diff --git a/.github/workflows/customer-ci.yaml b/.github/workflows/customer-ci.yaml index f613e7a953..9258bd4ade 100644 --- a/.github/workflows/customer-ci.yaml +++ b/.github/workflows/customer-ci.yaml @@ -27,16 +27,16 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - uses: ./.github/workflows/actions + - name: Run Maven Build Command + run: mvn clean install -pl customer -am - name: Run Maven Checkstyle if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} - run: mvn checkstyle:checkstyle -f customer -Dcheckstyle.output.file=customer-checkstyle-result.xml + run: mvn checkstyle:checkstyle -pl customer -am -Dcheckstyle.output.file=customer-checkstyle-result.xml - name: Upload Checkstyle Result if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} uses: jwgmeligmeyling/checkstyle-github-action@master with: path: '**/customer-checkstyle-result.xml' - - name: Run Maven Verify - run: mvn clean verify -f customer - name: Test Results uses: dorny/test-reporter@v1 if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} diff --git a/.github/workflows/inventory-ci.yaml b/.github/workflows/inventory-ci.yaml index 88611662f3..a5e362ba3b 100644 --- a/.github/workflows/inventory-ci.yaml +++ b/.github/workflows/inventory-ci.yaml @@ -27,16 +27,16 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - uses: ./.github/workflows/actions + - name: Run Maven Build Command + run: mvn clean install -pl inventory -am - name: Run Maven Checkstyle if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} - run: mvn checkstyle:checkstyle -f inventory -Dcheckstyle.output.file=inventory-checkstyle-result.xml + run: mvn checkstyle:checkstyle -pl inventory -am -Dcheckstyle.output.file=inventory-checkstyle-result.xml - name: Upload Checkstyle Result if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} uses: jwgmeligmeyling/checkstyle-github-action@master with: path: '**/inventory-checkstyle-result.xml' - - name: Run Maven Verify - run: mvn verify -f inventory - name: Test Results uses: dorny/test-reporter@v1 if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} diff --git a/.github/workflows/location-ci.yaml b/.github/workflows/location-ci.yaml index 819293bd5d..2199903905 100644 --- a/.github/workflows/location-ci.yaml +++ b/.github/workflows/location-ci.yaml @@ -27,16 +27,16 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - uses: ./.github/workflows/actions + - name: Run Maven Build Command + run: mvn clean install -pl location -am - name: Run Maven Checkstyle if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} - run: mvn checkstyle:checkstyle -f location -Dcheckstyle.output.file=location-checkstyle-result.xml + run: mvn checkstyle:checkstyle -pl location -am -Dcheckstyle.output.file=location-checkstyle-result.xml - name: Upload Checkstyle Result if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} uses: jwgmeligmeyling/checkstyle-github-action@master with: path: '**/location-checkstyle-result.xml' - - name: Run Maven Verify - run: mvn clean verify -f location - name: Test Results uses: dorny/test-reporter@v1 if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} diff --git a/.github/workflows/product-ci.yaml b/.github/workflows/product-ci.yaml index 31afe20710..caf92af448 100644 --- a/.github/workflows/product-ci.yaml +++ b/.github/workflows/product-ci.yaml @@ -27,6 +27,8 @@ jobs: with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - uses: ./.github/workflows/actions + - name: Run Maven Build Command + run: mvn clean install -pl product -am - name: Run Maven Checkstyle if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} run: mvn checkstyle:checkstyle -pl product -am -Dcheckstyle.output.file=product-checkstyle-result.xml @@ -35,8 +37,6 @@ jobs: uses: jwgmeligmeyling/checkstyle-github-action@master with: path: '**/product-checkstyle-result.xml' - - name: Run Maven Verify - run: mvn clean verify -f product - name: Test Results uses: dorny/test-reporter@v1 if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} diff --git a/cart/pom.xml b/cart/pom.xml index 9d711602e5..deb2ea453b 100644 --- a/cart/pom.xml +++ b/cart/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 com.yas @@ -48,6 +49,11 @@ org.liquibase liquibase-core + + com.yas + common-library + 1.0-SNAPSHOT + diff --git a/cart/src/it/java/com/yas/cart/service/CartServiceIT.java b/cart/src/it/java/com/yas/cart/service/CartServiceIT.java index b13b6324ad..4d79c10348 100644 --- a/cart/src/it/java/com/yas/cart/service/CartServiceIT.java +++ b/cart/src/it/java/com/yas/cart/service/CartServiceIT.java @@ -6,8 +6,6 @@ import static org.mockito.Mockito.when; import com.yas.cart.config.IntegrationTestConfiguration; -import com.yas.cart.exception.BadRequestException; -import com.yas.cart.exception.NotFoundException; import com.yas.cart.model.Cart; import com.yas.cart.model.CartItem; import com.yas.cart.repository.CartItemRepository; @@ -17,6 +15,8 @@ import com.yas.cart.viewmodel.CartItemVm; import com.yas.cart.viewmodel.CartListVm; import com.yas.cart.viewmodel.ProductThumbnailVm; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; import java.util.List; import java.util.Set; import org.junit.jupiter.api.AfterEach; @@ -33,31 +33,25 @@ @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) class CartServiceIT { + final String customerId1 = "customer-1"; private Cart cart1; - private Cart cart2; - @Autowired private CartRepository cartRepository; - @Autowired private CartItemRepository cartItemRepository; - @MockBean private ProductService productService; - @Autowired private CartService cartService; - final String customerId1 = "customer-1"; - @BeforeEach void setUp() { cart1 = cartRepository.save(Cart - .builder().customerId(customerId1).build()); + .builder().customerId(customerId1).build()); cart2 = cartRepository.save(Cart - .builder().customerId("customer-2").build()); + .builder().customerId("customer-2").build()); CartItem cartItem1 = new CartItem(); cartItem1.setProductId(1L); @@ -131,7 +125,7 @@ void removeCartItemListByProductIdList_SomeProductsExist_RemovesThem() { void removeCartItemListByProductIdList_NoCartItems_ThrowBadRequestException() { Cart cart3 = cartRepository.save(Cart - .builder().customerId("customer-3").build()); + .builder().customerId("customer-3").build()); cartRepository.save(cart3); @@ -179,7 +173,7 @@ void countNumberItemInCart_NoCart_ReturnsZero() { void countNumberItemInCart_EmptyCart_ReturnsZero() { Cart cart3 = cartRepository.save(Cart - .builder().customerId("customer-3").build()); + .builder().customerId("customer-3").build()); cartRepository.save(cart3); @@ -197,11 +191,11 @@ void countNumberItemInCart_NonEmptyCart_ReturnsCorrectCount() { void addToCart_ProductsExist_AddsItemsToNewCart() { List cartItemVms = List.of( - new CartItemVm(1L, 2, 10L) + new CartItemVm(1L, 2, 10L) ); List productThumbnails = List.of( - new ProductThumbnailVm(1L, "A21", "A22", "A23") + new ProductThumbnailVm(1L, "A21", "A22", "A23") ); when(productService.getProducts(List.of(1L))).thenReturn(productThumbnails); @@ -217,11 +211,11 @@ void addToCart_ProductsExist_AddsItemsToNewCart() { @Test void addToCart_ProductsExist_AddsItemsToExistingCart() { List cartItemVms = List.of( - new CartItemVm(3L, 2, 10L) + new CartItemVm(3L, 2, 10L) ); List productThumbnails = List.of( - new ProductThumbnailVm(3L, "A21", "A22", "A23") + new ProductThumbnailVm(3L, "A21", "A22", "A23") ); when(productService.getProducts(List.of(3L))).thenReturn(productThumbnails); @@ -248,7 +242,7 @@ void addToCart_SomeProductsDoNotExist_ThrowsNotFoundException() { assertThat(thrownException).isInstanceOf(NotFoundException.class); assertThat(thrownException.getMessage()) - .isEqualTo("Not found product [2]"); + .isEqualTo("Not found product [2]"); } diff --git a/cart/src/it/resources/application.properties b/cart/src/it/resources/application.properties index 7e1b6786cd..7b588357de 100644 --- a/cart/src/it/resources/application.properties +++ b/cart/src/it/resources/application.properties @@ -1,13 +1,10 @@ # Setting Spring context path & port server.servlet.context-path=/v1 server.port=8084 - spring.jpa.hibernate.ddl-auto=update spring.liquibase.enabled=false - # Setting Spring profile spring.profiles.active=test - spring.security.oauth2.resourceserver.jwt.issuer-uri=test springdoc.oauthflow.authorization-url=test springdoc.oauthflow.token-url=test \ No newline at end of file diff --git a/cart/src/it/resources/test-realm.json b/cart/src/it/resources/test-realm.json index ecf799f97d..665d9ae984 100644 --- a/cart/src/it/resources/test-realm.json +++ b/cart/src/it/resources/test-realm.json @@ -1,47 +1,47 @@ { - "id" : "quarkus", - "realm" : "quarkus", - "notBefore" : 0, - "revokeRefreshToken" : false, - "refreshTokenMaxReuse" : 0, - "accessTokenLifespan" : 300, - "accessTokenLifespanForImplicitFlow" : 900, - "ssoSessionIdleTimeout" : 1800, - "ssoSessionMaxLifespan" : 36000, - "ssoSessionIdleTimeoutRememberMe" : 0, - "ssoSessionMaxLifespanRememberMe" : 0, - "offlineSessionIdleTimeout" : 2592000, - "offlineSessionMaxLifespanEnabled" : false, - "offlineSessionMaxLifespan" : 5184000, - "clientSessionIdleTimeout" : 0, - "clientSessionMaxLifespan" : 0, - "clientOfflineSessionIdleTimeout" : 0, - "clientOfflineSessionMaxLifespan" : 0, - "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": "quarkus", + "realm": "quarkus", + "notBefore": 0, + "revokeRefreshToken": false, + "refreshTokenMaxReuse": 0, + "accessTokenLifespan": 300, + "accessTokenLifespanForImplicitFlow": 900, + "ssoSessionIdleTimeout": 1800, + "ssoSessionMaxLifespan": 36000, + "ssoSessionIdleTimeoutRememberMe": 0, + "ssoSessionMaxLifespanRememberMe": 0, + "offlineSessionIdleTimeout": 2592000, + "offlineSessionMaxLifespanEnabled": false, + "offlineSessionMaxLifespan": 5184000, + "clientSessionIdleTimeout": 0, + "clientSessionMaxLifespan": 0, + "clientOfflineSessionIdleTimeout": 0, + "clientOfflineSessionMaxLifespan": 0, + "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": "f2da71cd-654f-4beb-8ec8-fa78d6fc1219", "name": "default-roles-yas", @@ -66,1792 +66,2208 @@ "attributes": {} }, { - "id" : "5ae801de-cd65-42c1-ac5e-3b051abadcff", - "name" : "admin", - "composite" : false, - "clientRole" : false, - "containerId" : "quarkus", - "attributes" : { } - }, { - "id" : "2bca19e3-c333-41fb-8549-526536f039fb", - "name" : "uma_authorization", - "description" : "${role_uma_authorization}", - "composite" : false, - "clientRole" : false, - "containerId" : "quarkus", - "attributes" : { } - }, { - "id" : "c924843b-38ab-4c85-871c-86f6e0b47500", - "name" : "user", - "composite" : false, - "clientRole" : false, - "containerId" : "quarkus", - "attributes" : { } - }, { - "id" : "589c3954-acfd-4689-815d-d3e7ce172045", - "name" : "offline_access", - "description" : "${role_offline-access}", - "composite" : false, - "clientRole" : false, - "containerId" : "quarkus", - "attributes" : { } - } ], - "client" : { - "realm-management" : [ { - "id" : "1c1db47d-3e9f-4bcb-aa37-b5b4b0d67942", - "name" : "view-identity-providers", - "description" : "${role_view-identity-providers}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "f3deb521-8e02-4496-a242-e015c32e42ad", - "name" : "manage-authorization", - "description" : "${role_manage-authorization}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "e9f35eb2-f3e6-41ac-aac9-0f540fbb1f2d", - "name" : "manage-identity-providers", - "description" : "${role_manage-identity-providers}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "83d46ffc-8744-4fd6-a407-75098529adb7", - "name" : "manage-realm", - "description" : "${role_manage-realm}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "23f29143-b35a-4f3d-88bf-b1ac603ca86f", - "name" : "view-events", - "description" : "${role_view-events}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "ece87aaa-bbb1-48dc-b663-48a36dbb732a", - "name" : "create-client", - "description" : "${role_create-client}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "9b9d045d-2884-41ae-9a2a-484907ff664d", - "name" : "manage-clients", - "description" : "${role_manage-clients}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "89f6649a-1d40-4fab-a005-b892d6589764", - "name" : "view-authorization", - "description" : "${role_view-authorization}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "8414a9d2-4ae1-45bb-8746-d0d857067f97", - "name" : "query-realms", - "description" : "${role_query-realms}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "e02cdfef-d0ec-4e34-9457-76294b42adc5", - "name" : "query-clients", - "description" : "${role_query-clients}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "85cd6885-cb73-4ac8-93ec-8fc4d7c75999", - "name" : "manage-users", - "description" : "${role_manage-users}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "c8214f22-687a-45cb-a575-dea31b92ebe8", - "name" : "view-clients", - "description" : "${role_view-clients}", - "composite" : true, - "composites" : { - "client" : { - "realm-management" : [ "query-clients" ] - } + "id": "5ae801de-cd65-42c1-ac5e-3b051abadcff", + "name": "admin", + "composite": false, + "clientRole": false, + "containerId": "quarkus", + "attributes": {} + }, + { + "id": "2bca19e3-c333-41fb-8549-526536f039fb", + "name": "uma_authorization", + "description": "${role_uma_authorization}", + "composite": false, + "clientRole": false, + "containerId": "quarkus", + "attributes": {} + }, + { + "id": "c924843b-38ab-4c85-871c-86f6e0b47500", + "name": "user", + "composite": false, + "clientRole": false, + "containerId": "quarkus", + "attributes": {} + }, + { + "id": "589c3954-acfd-4689-815d-d3e7ce172045", + "name": "offline_access", + "description": "${role_offline-access}", + "composite": false, + "clientRole": false, + "containerId": "quarkus", + "attributes": {} + } + ], + "client": { + "realm-management": [ + { + "id": "1c1db47d-3e9f-4bcb-aa37-b5b4b0d67942", + "name": "view-identity-providers", + "description": "${role_view-identity-providers}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} }, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "4e01ff83-6d49-48e6-bbc1-37dff1bf876b", - "name" : "view-realm", - "description" : "${role_view-realm}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "0dc9eda3-37dd-46d5-8130-39046f3bcaf9", - "name" : "impersonation", - "description" : "${role_impersonation}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "a39504b0-e679-4e59-ab14-3c7727a4f5c3", - "name" : "query-groups", - "description" : "${role_query-groups}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "e1a6e15d-4b77-4a77-9348-bfc3190e2a2d", - "name" : "query-users", - "description" : "${role_query-users}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "3f29e90a-1f05-4f8e-82b6-32a39127d73b", - "name" : "realm-admin", - "description" : "${role_realm-admin}", - "composite" : true, - "composites" : { - "client" : { - "realm-management" : [ "view-identity-providers", "manage-identity-providers", "manage-authorization", "view-events", "manage-realm", "create-client", "manage-clients", "view-authorization", "query-realms", "query-clients", "view-clients", "manage-users", "view-realm", "impersonation", "query-groups", "view-users", "query-users", "manage-events" ] - } + { + "id": "f3deb521-8e02-4496-a242-e015c32e42ad", + "name": "manage-authorization", + "description": "${role_manage-authorization}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} }, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "7b3322f1-7bc8-456a-ab1f-9f06a4af9311", - "name" : "view-users", - "description" : "${role_view-users}", - "composite" : true, - "composites" : { - "client" : { - "realm-management" : [ "query-groups", "query-users" ] - } + { + "id": "e9f35eb2-f3e6-41ac-aac9-0f540fbb1f2d", + "name": "manage-identity-providers", + "description": "${role_manage-identity-providers}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} }, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - }, { - "id" : "0bb5515b-adc3-495e-8e38-d34bac2162a6", - "name" : "manage-events", - "description" : "${role_manage-events}", - "composite" : false, - "clientRole" : true, - "containerId" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "attributes" : { } - } ], - "security-admin-console" : [ ], - "admin-cli" : [ ], - "quarkus-service" : [ ], - "account-console" : [ ], - "broker" : [ { - "id" : "7a996641-0139-4e46-9cf8-96273e57d0ba", - "name" : "read-token", - "description" : "${role_read-token}", - "composite" : false, - "clientRole" : true, - "containerId" : "d4c8f765-b8b3-44fa-a99c-4001172f98f3", - "attributes" : { } - } ], - "account" : [ { - "id" : "4f26a889-000a-41ee-b3cc-c6db5a344833", - "name" : "delete-account", - "description" : "${role_delete-account}", - "composite" : false, - "clientRole" : true, - "containerId" : "b2ef7463-a161-4bd7-a9d3-361633512bce", - "attributes" : { } - }, { - "id" : "04c2755b-e926-467b-983e-3eb3bb23e5a5", - "name" : "view-applications", - "description" : "${role_view-applications}", - "composite" : false, - "clientRole" : true, - "containerId" : "b2ef7463-a161-4bd7-a9d3-361633512bce", - "attributes" : { } - }, { - "id" : "ee3d20f8-544f-49d9-b98c-0e46589c67f1", - "name" : "view-profile", - "description" : "${role_view-profile}", - "composite" : false, - "clientRole" : true, - "containerId" : "b2ef7463-a161-4bd7-a9d3-361633512bce", - "attributes" : { } - }, { - "id" : "3b991fa9-2469-402a-a249-fb237cf6f364", - "name" : "manage-account-links", - "description" : "${role_manage-account-links}", - "composite" : false, - "clientRole" : true, - "containerId" : "b2ef7463-a161-4bd7-a9d3-361633512bce", - "attributes" : { } - }, { - "id" : "79fdb572-7eb9-4236-adc1-61d95d9e10d2", - "name" : "manage-account", - "description" : "${role_manage-account}", - "composite" : true, - "composites" : { - "client" : { - "account" : [ "manage-account-links" ] - } + { + "id": "83d46ffc-8744-4fd6-a407-75098529adb7", + "name": "manage-realm", + "description": "${role_manage-realm}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} }, - "clientRole" : true, - "containerId" : "b2ef7463-a161-4bd7-a9d3-361633512bce", - "attributes" : { } - }, { - "id" : "66ddea7c-27a7-4ab9-bc0b-bf404ab84199", - "name" : "manage-consent", - "description" : "${role_manage-consent}", - "composite" : true, - "composites" : { - "client" : { - "account" : [ "view-consent" ] - } + { + "id": "23f29143-b35a-4f3d-88bf-b1ac603ca86f", + "name": "view-events", + "description": "${role_view-events}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "ece87aaa-bbb1-48dc-b663-48a36dbb732a", + "name": "create-client", + "description": "${role_create-client}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "9b9d045d-2884-41ae-9a2a-484907ff664d", + "name": "manage-clients", + "description": "${role_manage-clients}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "89f6649a-1d40-4fab-a005-b892d6589764", + "name": "view-authorization", + "description": "${role_view-authorization}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "8414a9d2-4ae1-45bb-8746-d0d857067f97", + "name": "query-realms", + "description": "${role_query-realms}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "e02cdfef-d0ec-4e34-9457-76294b42adc5", + "name": "query-clients", + "description": "${role_query-clients}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "85cd6885-cb73-4ac8-93ec-8fc4d7c75999", + "name": "manage-users", + "description": "${role_manage-users}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "c8214f22-687a-45cb-a575-dea31b92ebe8", + "name": "view-clients", + "description": "${role_view-clients}", + "composite": true, + "composites": { + "client": { + "realm-management": [ + "query-clients" + ] + } + }, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "4e01ff83-6d49-48e6-bbc1-37dff1bf876b", + "name": "view-realm", + "description": "${role_view-realm}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "0dc9eda3-37dd-46d5-8130-39046f3bcaf9", + "name": "impersonation", + "description": "${role_impersonation}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "a39504b0-e679-4e59-ab14-3c7727a4f5c3", + "name": "query-groups", + "description": "${role_query-groups}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "e1a6e15d-4b77-4a77-9348-bfc3190e2a2d", + "name": "query-users", + "description": "${role_query-users}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "3f29e90a-1f05-4f8e-82b6-32a39127d73b", + "name": "realm-admin", + "description": "${role_realm-admin}", + "composite": true, + "composites": { + "client": { + "realm-management": [ + "view-identity-providers", + "manage-identity-providers", + "manage-authorization", + "view-events", + "manage-realm", + "create-client", + "manage-clients", + "view-authorization", + "query-realms", + "query-clients", + "view-clients", + "manage-users", + "view-realm", + "impersonation", + "query-groups", + "view-users", + "query-users", + "manage-events" + ] + } + }, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} }, - "clientRole" : true, - "containerId" : "b2ef7463-a161-4bd7-a9d3-361633512bce", - "attributes" : { } - }, { - "id" : "dad36647-a910-4b97-b8eb-4248dfc37252", - "name" : "view-consent", - "description" : "${role_view-consent}", - "composite" : false, - "clientRole" : true, - "containerId" : "b2ef7463-a161-4bd7-a9d3-361633512bce", - "attributes" : { } - } ] + { + "id": "7b3322f1-7bc8-456a-ab1f-9f06a4af9311", + "name": "view-users", + "description": "${role_view-users}", + "composite": true, + "composites": { + "client": { + "realm-management": [ + "query-groups", + "query-users" + ] + } + }, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + }, + { + "id": "0bb5515b-adc3-495e-8e38-d34bac2162a6", + "name": "manage-events", + "description": "${role_manage-events}", + "composite": false, + "clientRole": true, + "containerId": "752904b5-c4f5-473e-ba84-7d214afdf792", + "attributes": {} + } + ], + "security-admin-console": [], + "admin-cli": [], + "quarkus-service": [], + "account-console": [], + "broker": [ + { + "id": "7a996641-0139-4e46-9cf8-96273e57d0ba", + "name": "read-token", + "description": "${role_read-token}", + "composite": false, + "clientRole": true, + "containerId": "d4c8f765-b8b3-44fa-a99c-4001172f98f3", + "attributes": {} + } + ], + "account": [ + { + "id": "4f26a889-000a-41ee-b3cc-c6db5a344833", + "name": "delete-account", + "description": "${role_delete-account}", + "composite": false, + "clientRole": true, + "containerId": "b2ef7463-a161-4bd7-a9d3-361633512bce", + "attributes": {} + }, + { + "id": "04c2755b-e926-467b-983e-3eb3bb23e5a5", + "name": "view-applications", + "description": "${role_view-applications}", + "composite": false, + "clientRole": true, + "containerId": "b2ef7463-a161-4bd7-a9d3-361633512bce", + "attributes": {} + }, + { + "id": "ee3d20f8-544f-49d9-b98c-0e46589c67f1", + "name": "view-profile", + "description": "${role_view-profile}", + "composite": false, + "clientRole": true, + "containerId": "b2ef7463-a161-4bd7-a9d3-361633512bce", + "attributes": {} + }, + { + "id": "3b991fa9-2469-402a-a249-fb237cf6f364", + "name": "manage-account-links", + "description": "${role_manage-account-links}", + "composite": false, + "clientRole": true, + "containerId": "b2ef7463-a161-4bd7-a9d3-361633512bce", + "attributes": {} + }, + { + "id": "79fdb572-7eb9-4236-adc1-61d95d9e10d2", + "name": "manage-account", + "description": "${role_manage-account}", + "composite": true, + "composites": { + "client": { + "account": [ + "manage-account-links" + ] + } + }, + "clientRole": true, + "containerId": "b2ef7463-a161-4bd7-a9d3-361633512bce", + "attributes": {} + }, + { + "id": "66ddea7c-27a7-4ab9-bc0b-bf404ab84199", + "name": "manage-consent", + "description": "${role_manage-consent}", + "composite": true, + "composites": { + "client": { + "account": [ + "view-consent" + ] + } + }, + "clientRole": true, + "containerId": "b2ef7463-a161-4bd7-a9d3-361633512bce", + "attributes": {} + }, + { + "id": "dad36647-a910-4b97-b8eb-4248dfc37252", + "name": "view-consent", + "description": "${role_view-consent}", + "composite": false, + "clientRole": true, + "containerId": "b2ef7463-a161-4bd7-a9d3-361633512bce", + "attributes": {} + } + ] } }, - "groups" : [ ], - "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" : [ ], - "webAuthnPolicyPasswordlessRpEntityName" : "keycloak", - "webAuthnPolicyPasswordlessSignatureAlgorithms" : [ "ES256" ], - "webAuthnPolicyPasswordlessRpId" : "", - "webAuthnPolicyPasswordlessAttestationConveyancePreference" : "not specified", - "webAuthnPolicyPasswordlessAuthenticatorAttachment" : "not specified", - "webAuthnPolicyPasswordlessRequireResidentKey" : "not specified", - "webAuthnPolicyPasswordlessUserVerificationRequirement" : "not specified", - "webAuthnPolicyPasswordlessCreateTimeout" : 0, - "webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister" : false, - "webAuthnPolicyPasswordlessAcceptableAaguids" : [ ], - "users" : [ { - "id" : "7d40c686-612a-4b49-93fd-e28244f40136", - "createdTimestamp" : 1617800939748, - "username" : "admin", - "enabled" : true, - "totp" : false, - "emailVerified" : false, - "firstName" : "Admin", - "lastName" : "Admin", - "email" : "admin@localhost", - "credentials" : [ { - "id" : "b68a1141-f42e-4cba-8c7a-97a47fb81857", - "type" : "password", - "createdDate" : 1617800952774, - "secretData" : "{\"value\":\"5VL5vW+2wIu0SCW7Fy5EzktX5X6LkiDNjCp2MLrdudF9EiR3rs12dhGTHs5wyXlK9944I4e3iBsK01EVuzEXPw==\",\"salt\":\"6tTNIudRbWQhlZBB8vkjRg==\",\"additionalParameters\":{}}", - "credentialData" : "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\",\"additionalParameters\":{}}" - } ], - "disableableCredentialTypes" : [ ], - "requiredActions" : [ ], - "realmRoles": ["default-roles-yas", "ADMIN"], - "clientRoles" : { - "account" : [ "view-profile", "manage-account" ] - }, - "notBefore" : 0, - "groups" : [ ] - }, { - "id" : "af9b247a-ff16-424b-af38-e7473c16a406", - "createdTimestamp" : 1617800970630, - "username" : "john", - "enabled" : true, - "totp" : false, - "emailVerified" : false, - "firstName" : "John", - "lastName" : "Doe", - "email" : "john@localhost", - "credentials" : [ { - "id" : "e86c9af1-5e25-4918-bc70-457a3aade97b", - "type" : "password", - "createdDate" : 1617800978521, - "secretData" : "{\"value\":\"oMEimHrxfSIjQsi3bwdynWL3xUusgXK3YiaWV1bRtN+2yRFuPWDQ3UbeppxSH9DDJuI9euZuwFMsb3PUOgs78Q==\",\"salt\":\"8jLTvRKcWnSo8/Z5+vCG3A==\",\"additionalParameters\":{}}", - "credentialData" : "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\",\"additionalParameters\":{}}" - } ], - "disableableCredentialTypes" : [ ], - "requiredActions" : [ ], - "realmRoles" : [ "user" ], - "clientRoles" : { - "account" : [ "view-profile", "manage-account" ] + "groups": [], + "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": [], + "webAuthnPolicyPasswordlessRpEntityName": "keycloak", + "webAuthnPolicyPasswordlessSignatureAlgorithms": [ + "ES256" + ], + "webAuthnPolicyPasswordlessRpId": "", + "webAuthnPolicyPasswordlessAttestationConveyancePreference": "not specified", + "webAuthnPolicyPasswordlessAuthenticatorAttachment": "not specified", + "webAuthnPolicyPasswordlessRequireResidentKey": "not specified", + "webAuthnPolicyPasswordlessUserVerificationRequirement": "not specified", + "webAuthnPolicyPasswordlessCreateTimeout": 0, + "webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister": false, + "webAuthnPolicyPasswordlessAcceptableAaguids": [], + "users": [ + { + "id": "7d40c686-612a-4b49-93fd-e28244f40136", + "createdTimestamp": 1617800939748, + "username": "admin", + "enabled": true, + "totp": false, + "emailVerified": false, + "firstName": "Admin", + "lastName": "Admin", + "email": "admin@localhost", + "credentials": [ + { + "id": "b68a1141-f42e-4cba-8c7a-97a47fb81857", + "type": "password", + "createdDate": 1617800952774, + "secretData": "{\"value\":\"5VL5vW+2wIu0SCW7Fy5EzktX5X6LkiDNjCp2MLrdudF9EiR3rs12dhGTHs5wyXlK9944I4e3iBsK01EVuzEXPw==\",\"salt\":\"6tTNIudRbWQhlZBB8vkjRg==\",\"additionalParameters\":{}}", + "credentialData": "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\",\"additionalParameters\":{}}" + } + ], + "disableableCredentialTypes": [], + "requiredActions": [], + "realmRoles": [ + "default-roles-yas", + "ADMIN" + ], + "clientRoles": { + "account": [ + "view-profile", + "manage-account" + ] + }, + "notBefore": 0, + "groups": [] }, - "notBefore" : 0, - "groups" : [ ] - } ], - "scopeMappings" : [ { - "clientScope" : "offline_access", - "roles" : [ "offline_access" ] - } ], - "clientScopeMappings" : { - "account" : [ { - "client" : "account-console", - "roles" : [ "manage-account" ] - } ] + { + "id": "af9b247a-ff16-424b-af38-e7473c16a406", + "createdTimestamp": 1617800970630, + "username": "john", + "enabled": true, + "totp": false, + "emailVerified": false, + "firstName": "John", + "lastName": "Doe", + "email": "john@localhost", + "credentials": [ + { + "id": "e86c9af1-5e25-4918-bc70-457a3aade97b", + "type": "password", + "createdDate": 1617800978521, + "secretData": "{\"value\":\"oMEimHrxfSIjQsi3bwdynWL3xUusgXK3YiaWV1bRtN+2yRFuPWDQ3UbeppxSH9DDJuI9euZuwFMsb3PUOgs78Q==\",\"salt\":\"8jLTvRKcWnSo8/Z5+vCG3A==\",\"additionalParameters\":{}}", + "credentialData": "{\"hashIterations\":27500,\"algorithm\":\"pbkdf2-sha256\",\"additionalParameters\":{}}" + } + ], + "disableableCredentialTypes": [], + "requiredActions": [], + "realmRoles": [ + "user" + ], + "clientRoles": { + "account": [ + "view-profile", + "manage-account" + ] + }, + "notBefore": 0, + "groups": [] + } + ], + "scopeMappings": [ + { + "clientScope": "offline_access", + "roles": [ + "offline_access" + ] + } + ], + "clientScopeMappings": { + "account": [ + { + "client": "account-console", + "roles": [ + "manage-account" + ] + } + ] }, - "clients" : [ { - "id" : "b2ef7463-a161-4bd7-a9d3-361633512bce", - "clientId" : "account", - "name" : "${client_account}", - "rootUrl" : "${authBaseUrl}", - "baseUrl" : "/realms/quarkus/account/", - "surrogateAuthRequired" : false, - "enabled" : true, - "alwaysDisplayInConsole" : false, - "clientAuthenticatorType" : "client-secret", - "secret" : "46c49daf-fa62-4744-883d-d32e810cfb9c", - "defaultRoles" : [ "view-profile", "manage-account" ], - "redirectUris" : [ "/realms/quarkus/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" : "0e2c27dd-f217-4926-a575-4c59171f9f39", - "clientId" : "account-console", - "name" : "${client_account-console}", - "rootUrl" : "${authBaseUrl}", - "baseUrl" : "/realms/quarkus/account/", - "surrogateAuthRequired" : false, - "enabled" : true, - "alwaysDisplayInConsole" : false, - "clientAuthenticatorType" : "client-secret", - "secret" : "134ac396-96f5-432a-8241-faf3de2711f6", - "redirectUris" : [ "/realms/quarkus/account/*" ], - "webOrigins" : [ ], - "notBefore" : 0, - "bearerOnly" : false, - "consentRequired" : false, - "standardFlowEnabled" : true, - "implicitFlowEnabled" : false, - "directAccessGrantsEnabled" : false, - "serviceAccountsEnabled" : false, - "publicClient" : true, - "frontchannelLogout" : false, - "protocol" : "openid-connect", - "attributes" : { - "pkce.code.challenge.method" : "S256" + "clients": [ + { + "id": "b2ef7463-a161-4bd7-a9d3-361633512bce", + "clientId": "account", + "name": "${client_account}", + "rootUrl": "${authBaseUrl}", + "baseUrl": "/realms/quarkus/account/", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": false, + "clientAuthenticatorType": "client-secret", + "secret": "46c49daf-fa62-4744-883d-d32e810cfb9c", + "defaultRoles": [ + "view-profile", + "manage-account" + ], + "redirectUris": [ + "/realms/quarkus/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" + ] }, - "authenticationFlowBindingOverrides" : { }, - "fullScopeAllowed" : false, - "nodeReRegistrationTimeout" : 0, - "protocolMappers" : [ { - "id" : "ed59083f-a6e7-41f5-8caf-c49dfa04b969", - "name" : "audience resolve", - "protocol" : "openid-connect", - "protocolMapper" : "oidc-audience-resolve-mapper", - "consentRequired" : false, - "config" : { } - } ], - "defaultClientScopes" : [ "web-origins", "role_list", "roles", "profile", "email" ], - "optionalClientScopes" : [ "address", "phone", "offline_access", "microprofile-jwt" ] - }, { - "id" : "6f9a7a50-f05f-4833-8dba-2492a2a70b40", - "clientId" : "admin-cli", - "name" : "${client_admin-cli}", - "surrogateAuthRequired" : false, - "enabled" : true, - "alwaysDisplayInConsole" : false, - "clientAuthenticatorType" : "client-secret", - "secret" : "8caf9d87-7e94-4597-931a-4cb5357e72b2", - "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" : "d4c8f765-b8b3-44fa-a99c-4001172f98f3", - "clientId" : "broker", - "name" : "${client_broker}", - "surrogateAuthRequired" : false, - "enabled" : true, - "alwaysDisplayInConsole" : false, - "clientAuthenticatorType" : "client-secret", - "secret" : "590e533b-5a2d-4dd1-9419-d301f326cf0a", - "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" : "56443d41-f71f-490f-872c-5daa01b31a28", - "clientId" : "quarkus-service", - "surrogateAuthRequired" : false, - "enabled" : true, - "alwaysDisplayInConsole" : false, - "clientAuthenticatorType" : "client-secret", - "secret" : "secret", - "redirectUris" : [ "/*" ], - "webOrigins" : [ ], - "notBefore" : 0, - "bearerOnly" : false, - "consentRequired" : false, - "standardFlowEnabled" : true, - "implicitFlowEnabled" : false, - "directAccessGrantsEnabled" : true, - "serviceAccountsEnabled" : true, - "authorizationServicesEnabled": true, - "publicClient" : false, - "frontchannelLogout" : false, - "protocol" : "openid-connect", - "attributes" : { - "saml.assertion.signature" : "false", - "saml.multivalued.roles" : "false", - "saml.force.post.binding" : "false", - "saml.encrypt" : "false", - "post.logout.redirect.uris": "+", - "oauth2.device.authorization.grant.enabled": "false", - "backchannel.logout.revoke.offline.tokens" : "false", - "saml.server.signature" : "false", - "saml.server.signature.keyinfo.ext" : "false", - "exclude.session.state.from.auth.response" : "false", - "oidc.ciba.grant.enabled": "false", - "backchannel.logout.session.required" : "true", - "client_credentials.use_refresh_token" : "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" + { + "id": "0e2c27dd-f217-4926-a575-4c59171f9f39", + "clientId": "account-console", + "name": "${client_account-console}", + "rootUrl": "${authBaseUrl}", + "baseUrl": "/realms/quarkus/account/", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": false, + "clientAuthenticatorType": "client-secret", + "secret": "134ac396-96f5-432a-8241-faf3de2711f6", + "redirectUris": [ + "/realms/quarkus/account/*" + ], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": true, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": { + "pkce.code.challenge.method": "S256" + }, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "protocolMappers": [ + { + "id": "ed59083f-a6e7-41f5-8caf-c49dfa04b969", + "name": "audience resolve", + "protocol": "openid-connect", + "protocolMapper": "oidc-audience-resolve-mapper", + "consentRequired": false, + "config": {} + } + ], + "defaultClientScopes": [ + "web-origins", + "role_list", + "roles", + "profile", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] }, - "authenticationFlowBindingOverrides" : { }, - "fullScopeAllowed" : true, - "nodeReRegistrationTimeout" : -1, - "defaultClientScopes" : [ "web-origins", "role_list", "roles", "profile", "email" ], - "optionalClientScopes" : [ "address", "phone", "offline_access", "microprofile-jwt" ], - "authorizationSettings": { - "allowRemoteResourceManagement": true, - "policyEnforcementMode": "ENFORCING", - "resources": [ - { - "name": "Admin Resource", - "ownerManagedAccess": false, - "attributes": {}, - "_id": "d2b855d4-61f6-4159-9b89-b0257ad380c9", - "uris": [ - "/admin/*" - ], - "icon_uri": "" - }, + { + "id": "6f9a7a50-f05f-4833-8dba-2492a2a70b40", + "clientId": "admin-cli", + "name": "${client_admin-cli}", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": false, + "clientAuthenticatorType": "client-secret", + "secret": "8caf9d87-7e94-4597-931a-4cb5357e72b2", + "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": "d4c8f765-b8b3-44fa-a99c-4001172f98f3", + "clientId": "broker", + "name": "${client_broker}", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": false, + "clientAuthenticatorType": "client-secret", + "secret": "590e533b-5a2d-4dd1-9419-d301f326cf0a", + "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": "56443d41-f71f-490f-872c-5daa01b31a28", + "clientId": "quarkus-service", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": false, + "clientAuthenticatorType": "client-secret", + "secret": "secret", + "redirectUris": [ + "/*" + ], + "webOrigins": [], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": true, + "authorizationServicesEnabled": true, + "publicClient": false, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": { + "saml.assertion.signature": "false", + "saml.multivalued.roles": "false", + "saml.force.post.binding": "false", + "saml.encrypt": "false", + "post.logout.redirect.uris": "+", + "oauth2.device.authorization.grant.enabled": "false", + "backchannel.logout.revoke.offline.tokens": "false", + "saml.server.signature": "false", + "saml.server.signature.keyinfo.ext": "false", + "exclude.session.state.from.auth.response": "false", + "oidc.ciba.grant.enabled": "false", + "backchannel.logout.session.required": "true", + "client_credentials.use_refresh_token": "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": [ + "web-origins", + "role_list", + "roles", + "profile", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ], + "authorizationSettings": { + "allowRemoteResourceManagement": true, + "policyEnforcementMode": "ENFORCING", + "resources": [ + { + "name": "Admin Resource", + "ownerManagedAccess": false, + "attributes": {}, + "_id": "d2b855d4-61f6-4159-9b89-b0257ad380c9", + "uris": [ + "/admin/*" + ], + "icon_uri": "" + }, + { + "name": "User Resource", + "ownerManagedAccess": false, + "attributes": {}, + "_id": "6f589c2e-160c-487b-8e8c-8141dc441b2a", + "uris": [ + "/users/*" + ], + "icon_uri": "" + } + ], + "policies": [ + { + "id": "2aaaff19-710d-479d-80b8-ef57e4e258d8", + "name": "Any User Policy", + "description": "Any user granted with the user role can access something", + "type": "role", + "logic": "POSITIVE", + "decisionStrategy": "UNANIMOUS", + "config": { + "roles": "[{\"id\":\"user\",\"required\":false}]" + } + }, + { + "id": "43b4ae35-5fc4-45d7-b0a2-501e772ecb84", + "name": "Only Admins", + "description": "Only administrators can access", + "type": "role", + "logic": "POSITIVE", + "decisionStrategy": "UNANIMOUS", + "config": { + "roles": "[{\"id\":\"admin\",\"required\":false}]" + } + }, + { + "id": "06fc24d8-1f84-46f4-ae7b-e13a505195f1", + "name": "User Resource Permission", + "description": "", + "type": "resource", + "logic": "POSITIVE", + "decisionStrategy": "UNANIMOUS", + "config": { + "defaultResourceType": "", + "resources": "[\"User Resource\"]", + "applyPolicies": "[\"Any User Policy\"]" + } + }, + { + "id": "d75310e2-8b14-4c88-9148-2fa82220e30b", + "name": "Admin Resource Permission", + "description": "", + "type": "resource", + "logic": "POSITIVE", + "decisionStrategy": "UNANIMOUS", + "config": { + "resources": "[\"Admin Resource\"]", + "applyPolicies": "[\"Only Admins\"]" + } + } + ], + "scopes": [], + "decisionStrategy": "UNANIMOUS" + } + }, + { + "id": "752904b5-c4f5-473e-ba84-7d214afdf792", + "clientId": "realm-management", + "name": "${client_realm-management}", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": false, + "clientAuthenticatorType": "client-secret", + "secret": "70fd3aa0-f353-4860-9a67-5eb86684e0a8", + "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": "b720bc75-35bf-4dcd-a5a9-90d1267a3b04", + "clientId": "security-admin-console", + "name": "${client_security-admin-console}", + "rootUrl": "${authAdminUrl}", + "baseUrl": "/admin/quarkus/console/", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": false, + "clientAuthenticatorType": "client-secret", + "secret": "55fbb9e1-4410-48b7-b1ad-7b043144b859", + "redirectUris": [ + "/admin/quarkus/console/*" + ], + "webOrigins": [ + "+" + ], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": false, + "serviceAccountsEnabled": false, + "publicClient": true, + "frontchannelLogout": false, + "protocol": "openid-connect", + "attributes": { + "pkce.code.challenge.method": "S256" + }, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": false, + "nodeReRegistrationTimeout": 0, + "protocolMappers": [ { - "name": "User Resource", - "ownerManagedAccess": false, - "attributes": {}, - "_id": "6f589c2e-160c-487b-8e8c-8141dc441b2a", - "uris": [ - "/users/*" - ], - "icon_uri": "" + "id": "44e02e60-ae62-4b32-b20b-226565749528", + "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" + } } ], - "policies": [ - { - "id": "2aaaff19-710d-479d-80b8-ef57e4e258d8", - "name": "Any User Policy", - "description": "Any user granted with the user role can access something", - "type": "role", - "logic": "POSITIVE", - "decisionStrategy": "UNANIMOUS", + "defaultClientScopes": [ + "web-origins", + "role_list", + "roles", + "profile", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ] + } + ], + "clientScopes": [ + { + "id": "0110b627-1823-4aa2-9c12-e25eb8bc1d24", + "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": "14a58948-73a4-4679-ae93-93e7cf91f337", + "name": "role_list", + "description": "SAML role list", + "protocol": "saml", + "attributes": { + "consent.screen.text": "${samlRoleListScopeConsentText}", + "display.on.consent.screen": "true" + }, + "protocolMappers": [ + { + "id": "203f72b9-e269-4433-a1d6-5067a82e6029", + "name": "role list", + "protocol": "saml", + "protocolMapper": "saml-role-list-mapper", + "consentRequired": false, + "config": { + "single": "false", + "attribute.nameformat": "Basic", + "attribute.name": "Role" + } + } + ] + }, + { + "id": "e8d6fa1d-5d10-4388-a815-b8cc269cf521", + "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": "e0d1b63e-956f-43aa-8bf0-5331d2b6160c", + "name": "given name", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, "config": { - "roles": "[{\"id\":\"user\",\"required\":false}]" + "userinfo.token.claim": "true", + "user.attribute": "firstName", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "given_name", + "jsonType.label": "String" } }, { - "id": "43b4ae35-5fc4-45d7-b0a2-501e772ecb84", - "name": "Only Admins", - "description": "Only administrators can access", - "type": "role", - "logic": "POSITIVE", - "decisionStrategy": "UNANIMOUS", + "id": "dfa55ca4-9c69-4238-bebf-9bcc9144508e", + "name": "username", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-property-mapper", + "consentRequired": false, "config": { - "roles": "[{\"id\":\"admin\",\"required\":false}]" + "userinfo.token.claim": "true", + "user.attribute": "username", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "preferred_username", + "jsonType.label": "String" } }, { - "id": "06fc24d8-1f84-46f4-ae7b-e13a505195f1", - "name": "User Resource Permission", - "description": "", - "type": "resource", - "logic": "POSITIVE", - "decisionStrategy": "UNANIMOUS", + "id": "bae556b2-5a2e-4eea-b5cb-717e0c4cbf5f", + "name": "gender", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, "config": { - "defaultResourceType": "", - "resources": "[\"User Resource\"]", - "applyPolicies": "[\"Any User Policy\"]" + "userinfo.token.claim": "true", + "user.attribute": "gender", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "gender", + "jsonType.label": "String" } }, { - "id": "d75310e2-8b14-4c88-9148-2fa82220e30b", - "name": "Admin Resource Permission", - "description": "", - "type": "resource", - "logic": "POSITIVE", - "decisionStrategy": "UNANIMOUS", + "id": "9a4b7133-a0f3-4043-884e-b9bf571c81d7", + "name": "locale", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-attribute-mapper", + "consentRequired": false, "config": { - "resources": "[\"Admin Resource\"]", - "applyPolicies": "[\"Only Admins\"]" + "userinfo.token.claim": "true", + "user.attribute": "locale", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "locale", + "jsonType.label": "String" + } + }, + { + "id": "6164139c-c1f4-44bb-9c22-800e2d21ca09", + "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": "527d79d0-1966-4b90-92f0-0b54c623d596", + "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": "39655902-2b3a-4205-a8db-03ad38bb4df6", + "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": "3e9b71e1-0829-4a57-80ff-09f2718abf13", + "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": "d6f5b49a-df41-4fee-93ec-246e5202fdff", + "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": "5a648f3a-07d2-4c8d-afe8-c1accb9b1187", + "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": "b7e2d1ac-2517-4df1-b9a9-afb925339731", + "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": "0c2ab3b5-f6c6-45d8-8894-3cf71dc6fb38", + "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": "9e7b6084-7a84-4699-9b51-d619094f4ff9", + "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": "61ab8691-6995-4d4f-8917-67093c8aedfb", + "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" } } - ], - "scopes": [], - "decisionStrategy": "UNANIMOUS" - } - }, { - "id" : "752904b5-c4f5-473e-ba84-7d214afdf792", - "clientId" : "realm-management", - "name" : "${client_realm-management}", - "surrogateAuthRequired" : false, - "enabled" : true, - "alwaysDisplayInConsole" : false, - "clientAuthenticatorType" : "client-secret", - "secret" : "70fd3aa0-f353-4860-9a67-5eb86684e0a8", - "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" : "b720bc75-35bf-4dcd-a5a9-90d1267a3b04", - "clientId" : "security-admin-console", - "name" : "${client_security-admin-console}", - "rootUrl" : "${authAdminUrl}", - "baseUrl" : "/admin/quarkus/console/", - "surrogateAuthRequired" : false, - "enabled" : true, - "alwaysDisplayInConsole" : false, - "clientAuthenticatorType" : "client-secret", - "secret" : "55fbb9e1-4410-48b7-b1ad-7b043144b859", - "redirectUris" : [ "/admin/quarkus/console/*" ], - "webOrigins" : [ "+" ], - "notBefore" : 0, - "bearerOnly" : false, - "consentRequired" : false, - "standardFlowEnabled" : true, - "implicitFlowEnabled" : false, - "directAccessGrantsEnabled" : false, - "serviceAccountsEnabled" : false, - "publicClient" : true, - "frontchannelLogout" : false, - "protocol" : "openid-connect", - "attributes" : { - "pkce.code.challenge.method" : "S256" + ] }, - "authenticationFlowBindingOverrides" : { }, - "fullScopeAllowed" : false, - "nodeReRegistrationTimeout" : 0, - "protocolMappers" : [ { - "id" : "44e02e60-ae62-4b32-b20b-226565749528", - "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" : "0110b627-1823-4aa2-9c12-e25eb8bc1d24", - "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" : "14a58948-73a4-4679-ae93-93e7cf91f337", - "name" : "role_list", - "description" : "SAML role list", - "protocol" : "saml", - "attributes" : { - "consent.screen.text" : "${samlRoleListScopeConsentText}", - "display.on.consent.screen" : "true" + { + "id": "183a7265-5d2a-41bd-baf0-dd376b366063", + "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": "887b7325-71e4-4eac-a197-6948862cb928", + "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": "7f540ab7-f7b6-41d7-b56c-5b63ec354abe", + "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" + } + } + ] }, - "protocolMappers" : [ { - "id" : "203f72b9-e269-4433-a1d6-5067a82e6029", - "name" : "role list", - "protocol" : "saml", - "protocolMapper" : "saml-role-list-mapper", - "consentRequired" : false, - "config" : { - "single" : "false", - "attribute.nameformat" : "Basic", - "attribute.name" : "Role" - } - } ] - }, { - "id" : "e8d6fa1d-5d10-4388-a815-b8cc269cf521", - "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}" + { + "id": "bf8af7d9-fff7-427e-880e-62ea16ab94e9", + "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": "cd85be29-34ed-47e2-b0ce-2270f8061f09", + "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" + } + } + ] }, - "protocolMappers" : [ { - "id" : "e0d1b63e-956f-43aa-8bf0-5331d2b6160c", - "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" : "dfa55ca4-9c69-4238-bebf-9bcc9144508e", - "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" : "bae556b2-5a2e-4eea-b5cb-717e0c4cbf5f", - "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" : "9a4b7133-a0f3-4043-884e-b9bf571c81d7", - "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" : "6164139c-c1f4-44bb-9c22-800e2d21ca09", - "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" : "527d79d0-1966-4b90-92f0-0b54c623d596", - "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" : "39655902-2b3a-4205-a8db-03ad38bb4df6", - "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" : "3e9b71e1-0829-4a57-80ff-09f2718abf13", - "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" : "d6f5b49a-df41-4fee-93ec-246e5202fdff", - "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" : "5a648f3a-07d2-4c8d-afe8-c1accb9b1187", - "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" : "b7e2d1ac-2517-4df1-b9a9-afb925339731", - "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" : "0c2ab3b5-f6c6-45d8-8894-3cf71dc6fb38", - "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" : "9e7b6084-7a84-4699-9b51-d619094f4ff9", - "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" : "61ab8691-6995-4d4f-8917-67093c8aedfb", - "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" : "183a7265-5d2a-41bd-baf0-dd376b366063", - "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}" + { + "id": "abed9a36-8900-4eec-9d58-9528f6f284ac", + "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": "ef60ce57-9cfa-449c-9624-f74a16944327", + "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": "b3636e01-5cb1-4ce2-b08a-913f15bbc738", + "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" + } + } + ] }, - "protocolMappers" : [ { - "id" : "887b7325-71e4-4eac-a197-6948862cb928", - "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" : "7f540ab7-f7b6-41d7-b56c-5b63ec354abe", - "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" : "bf8af7d9-fff7-427e-880e-62ea16ab94e9", - "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}" + { + "id": "2036bd5e-f33d-442d-8ed0-6bf9a50ad45d", + "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": "73ac1825-7ac3-40ad-8f38-b2620808b02f", + "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": "0d0ca6ec-e6cc-425f-ba92-2ed4b7778faf", + "name": "audience resolve", + "protocol": "openid-connect", + "protocolMapper": "oidc-audience-resolve-mapper", + "consentRequired": false, + "config": {} + }, + { + "id": "aa5d7eab-30e5-49eb-a4fe-4ad425fffd64", + "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" + } + } + ] }, - "protocolMappers" : [ { - "id" : "cd85be29-34ed-47e2-b0ce-2270f8061f09", - "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" : "abed9a36-8900-4eec-9d58-9528f6f284ac", - "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}" + { + "id": "4c7b020d-ab2d-4cee-a9c1-26b5a28453df", + "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": "9762fd5d-17bf-4666-b538-0adee5f584c3", + "name": "allowed web origins", + "protocol": "openid-connect", + "protocolMapper": "oidc-allowed-origins-mapper", + "consentRequired": false, + "config": {} + } + ] }, - "protocolMappers" : [ { - "id" : "ef60ce57-9cfa-449c-9624-f74a16944327", - "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": "92cb2a60-3a1f-4bf1-94b9-078e80cff964", + "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": "1354aade-9a9f-41db-a462-f2071532fd6f", + "name": "groups", + "protocol": "openid-connect", + "protocolMapper": "oidc-usermodel-realm-role-mapper", + "consentRequired": false, + "config": { + "multivalued": "true", + "user.attribute": "foo", + "id.token.claim": "true", + "access.token.claim": "true", + "claim.name": "groups", + "jsonType.label": "String" + } + }, + { + "id": "0e78dfa6-86dd-4960-a23b-44c3329df528", + "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" + } + } + ] + } + ], + "defaultDefaultClientScopes": [ + "role_list", + "profile", + "email", + "roles", + "web-origins" + ], + "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, + "identityProviders": [], + "identityProviderMappers": [], + "components": { + "org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy": [ + { + "id": "a033e338-3cfe-4440-85dd-ec4a332742fd", + "name": "Consent Required", + "providerId": "consent-required", + "subType": "anonymous", + "subComponents": {}, + "config": {} + }, + { + "id": "66eb3397-e784-4b4d-8242-5385453197b7", + "name": "Allowed Protocol Mapper Types", + "providerId": "allowed-protocol-mappers", + "subType": "anonymous", + "subComponents": {}, + "config": { + "allowed-protocol-mapper-types": [ + "saml-user-attribute-mapper", + "oidc-full-name-mapper", + "oidc-usermodel-property-mapper", + "oidc-usermodel-attribute-mapper", + "saml-role-list-mapper", + "oidc-sha256-pairwise-sub-mapper", + "oidc-address-mapper", + "saml-user-property-mapper" + ] + } + }, + { + "id": "3e836a32-ff93-46e6-8e1f-7e320507388f", + "name": "Allowed Client Scopes", + "providerId": "allowed-client-templates", + "subType": "authenticated", + "subComponents": {}, + "config": { + "allow-default-scopes": [ + "true" + ] + } + }, + { + "id": "bad9c53c-6b7b-431f-a4f4-62970f9af1e2", + "name": "Max Clients Limit", + "providerId": "max-clients", + "subType": "anonymous", + "subComponents": {}, + "config": { + "max-clients": [ + "200" + ] + } + }, + { + "id": "174410e0-cd98-4a90-bfc3-68a8980b87e7", + "name": "Allowed Client Scopes", + "providerId": "allowed-client-templates", + "subType": "anonymous", + "subComponents": {}, + "config": { + "allow-default-scopes": [ + "true" + ] + } + }, + { + "id": "2b9ca142-85a0-448d-bde9-800f7823cac1", + "name": "Trusted Hosts", + "providerId": "trusted-hosts", + "subType": "anonymous", + "subComponents": {}, + "config": { + "host-sending-registration-request-must-match": [ + "true" + ], + "client-uris-must-match": [ + "true" + ] + } + }, + { + "id": "4271132b-929b-4b76-a94e-aeafa71715ec", + "name": "Full Scope Disabled", + "providerId": "scope", + "subType": "anonymous", + "subComponents": {}, + "config": {} + }, + { + "id": "6ab250a9-d27b-4c5c-8cdf-0b8adee370d4", + "name": "Allowed Protocol Mapper Types", + "providerId": "allowed-protocol-mappers", + "subType": "authenticated", + "subComponents": {}, + "config": { + "allowed-protocol-mapper-types": [ + "oidc-usermodel-attribute-mapper", + "saml-user-property-mapper", + "oidc-usermodel-property-mapper", + "oidc-full-name-mapper", + "saml-user-attribute-mapper", + "saml-role-list-mapper", + "oidc-address-mapper", + "oidc-sha256-pairwise-sub-mapper" + ] + } } - }, { - "id" : "b3636e01-5cb1-4ce2-b08a-913f15bbc738", - "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" + ], + "org.keycloak.keys.KeyProvider": [ + { + "id": "e7f99358-99f3-4fb6-a65d-5771a0c07f38", + "name": "hmac-generated", + "providerId": "hmac-generated", + "subComponents": {}, + "config": { + "kid": [ + "a7c0b05e-7852-492d-a712-30ce7c6e48a6" + ], + "secret": [ + "gh6Ab3iAF2CiWam3ly0OZcwfMPRNn6s0lgqmn177iHBSebirfHRkahPjJGmGVHS9fmqRidaOV8v1YoxF0lhv5Q" + ], + "priority": [ + "100" + ], + "algorithm": [ + "HS256" + ] + } + }, + { + "id": "30fe7115-b6e4-4ed8-b350-73a160895f4c", + "name": "rsa-generated", + "providerId": "rsa-generated", + "subComponents": {}, + "config": { + "privateKey": [ + "MIIEowIBAAKCAQEAnTsWCUKow1fwyn/p38MM7SfuS1KzDGGWPLcrt4r6Hy2vPG8G6psABbkA2+if5y+614vjLKaG2g33bU4OkoVOcGtISMN+Fc2J+i/Fd250PaLCe89uRzrHc2q+6bgMuvOnNtcOJqR+Y+Zrs34kG0izWe+dHTNrgav4WKbpKzAR3ZlCNIkVU81m2LG+u6MyQJpN3RiOaeBC/vtxCGHPO4BTHA4cCeXVd8P9Gczh5WqSH+Es5dQRxfLiWDLbV+BeAeDvJIhJq8yuLkjBBnq1w5TASVf8U+LsVVWCwUy/lDXDX7G2EVU+BRq9hfRPRkiXcN+CigZVr6b8JXdUH4Kh/PF2QwIDAQABAoIBAG1YLw4HnqgjW2DorjQgSLgRYgZeIAjHQR0+YZfGfgX61nhX2l6DpvNT4sYMtE+qAO1v6nAd64Bv4BfTBg1dydwir+VylxgAlik42cIiPZKzwz8pVc8RkK2ymcyeY7QMSMi5rKyxDvjYwSPV4LRczeYI3qH1JZnLh+3XPib7yiDqIQhMEPxxdOGzidwSwijTzVfOt5ltsk5T4ZCsGpWvoGnvNQYRlt4AdewGP0Mg0hacS21y5M6B1he+z9Tnb2/uIloGvEBHNCPsvn6qXmszoZhKH4FueP6cfgO4342jR8ksEhwlpgmAQ87B5zabMyRbstnazr1Am1dgCAQRto+xFXECgYEA3e8rqymsdVwnbjFsSv6K67SvnJdqFFHAcdzqeCoOsy0JBlb3ck9zvW/8R0dMx0YQ83dxlvKxCESOhroSHQ4P38N4t4CeOOSPhBnYFnfc3n75ckro1fp3WWL4Dq/oN63wiaNQCISz5HYdqXs9GXMVn5GRS8kr70qa3PrXY8RGa/sCgYEAtV1qcEoqMUVQGSYF3eWlXqTVn4RvonIg87Jw/dnaPnSUcy8+80+ipJiCInzRsZ+ApPNie+VStdg7mz0pDGkA9vqDX1SQYsp5XcCtq49Pt+Oc8woPowjY+rU8Us5v+BYM2RjAhO85+obsXkPchQsC+au6IODrA3awGHb5cuNyBFkCgYEAnbpqTbZLdAkvmNgVP+NR9hyvJlpSMOi9He9E0GwLkHn0TQYnzJz9A+h/4mShA4sfZvk/yGjpOpgGt2eskeu5im1Q8RG+4W5HNTps4eMEHTkerYThn5nnkqaM51tLba74IcnoinVNqJPtltMYZGrvNj3thnAOAn4CPAUmaShIaFsCgYAkWLpSEqruAOQShio61CEWHJarR1FQDutHq4U1eolgZuCxTNCi1lzT+7Ro0Pb9T+fqJtSf2899nf4kGFe3ovuMg5v8aOgexFEaVtj3PttNERKNKoEDvWwuok+akMCjyVd90pYSjhbifFO2eIcjKpfIDYBZwnmW0hxsaruHKMna0QKBgEYF8xk/XqDViV2a7C8byQNBXwFWzct+rcdj9yOMqdWl8XTBU7Tf2YojRKGjkpMHnrNbDCQPUYcKoIYZBWdkiufe5WTDU/3yLZjbMl+9jC9MQ3sXSZqWEqsdKDFZVFFXWNMxbmSPZMLWm3kWM0yxGg3e2il/NHpiNjssEz/toasC" + ], + "certificate": [ + "MIICnTCCAYUCBgF4rE75SjANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDDAdxdWFya3VzMB4XDTIxMDQwNzEyMjc0MFoXDTMxMDQwNzEyMjkyMFowEjEQMA4GA1UEAwwHcXVhcmt1czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ07FglCqMNX8Mp/6d/DDO0n7ktSswxhljy3K7eK+h8trzxvBuqbAAW5ANvon+cvuteL4yymhtoN921ODpKFTnBrSEjDfhXNifovxXdudD2iwnvPbkc6x3Nqvum4DLrzpzbXDiakfmPma7N+JBtIs1nvnR0za4Gr+Fim6SswEd2ZQjSJFVPNZtixvrujMkCaTd0YjmngQv77cQhhzzuAUxwOHAnl1XfD/RnM4eVqkh/hLOXUEcXy4lgy21fgXgHg7ySISavMri5IwQZ6tcOUwElX/FPi7FVVgsFMv5Q1w1+xthFVPgUavYX0T0ZIl3DfgooGVa+m/CV3VB+CofzxdkMCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEACWVoMh1jB64LEiOzHrwDWeWDHRZMrb1TBcfC6ALjFDBako0AbSHxBqN6FJgN6C3BhzCBcI4LR6I8bpqGuZ9y9zE8hRj8oAtEAXnPdMSWsWEBBFdbSBDeBE9Q8jXJ5LCk+Iz/5HcPJTgUpkJdKmzIWqp1hI4zOb1+GZrERg04Ue+xP6DTCOZkcofA3twzqM0Eifig8UoSUlejUKXCISbcO39slcFNGbPDPsUNjWUgVG79TZExtF02KmbzEifh+aQi0jb3/d5gSPEOSW+n8CC/zW0woDZQ4ZhspDUeQyIafy0JPlgZljsWBbWpJ0ZJIiWVTWxO7T1ogiyFtLoX2sinJA==" + ], + "priority": [ + "100" + ] + } + }, + { + "id": "1d927d6c-779e-4fea-a2a4-a3dd194c1a8f", + "name": "aes-generated", + "providerId": "aes-generated", + "subComponents": {}, + "config": { + "kid": [ + "12395eb8-d68a-4272-b88e-3e2a2096e2e6" + ], + "secret": [ + "uqAMrTEXiIXom7DjxnnWEw" + ], + "priority": [ + "100" + ] + } } - } ] - }, { - "id" : "2036bd5e-f33d-442d-8ed0-6bf9a50ad45d", - "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}" + ] + }, + "internationalizationEnabled": false, + "supportedLocales": [], + "authenticationFlows": [ + { + "id": "0b0bb974-6484-4dbc-bc0c-7a3ce27a1a2f", + "alias": "Account verification options", + "description": "Method with which to verity the existing account", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "idp-email-verification", + "requirement": "ALTERNATIVE", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "ALTERNATIVE", + "priority": 20, + "flowAlias": "Verify Existing Account by Re-authentication", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] }, - "protocolMappers" : [ { - "id" : "73ac1825-7ac3-40ad-8f38-b2620808b02f", - "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" : "0d0ca6ec-e6cc-425f-ba92-2ed4b7778faf", - "name" : "audience resolve", - "protocol" : "openid-connect", - "protocolMapper" : "oidc-audience-resolve-mapper", - "consentRequired" : false, - "config" : { } - }, { - "id" : "aa5d7eab-30e5-49eb-a4fe-4ad425fffd64", - "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" : "4c7b020d-ab2d-4cee-a9c1-26b5a28453df", - "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" : "" + { + "id": "b7f60e5e-94c8-4ede-ab61-ced8b2fea44a", + "alias": "Authentication Options", + "description": "Authentication options.", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticator": "basic-auth", + "requirement": "REQUIRED", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "basic-auth-otp", + "requirement": "DISABLED", + "priority": 20, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "authenticator": "auth-spnego", + "requirement": "DISABLED", + "priority": 30, + "userSetupAllowed": false, + "autheticatorFlow": false + } + ] }, - "protocolMappers" : [ { - "id" : "9762fd5d-17bf-4666-b538-0adee5f584c3", - "name" : "allowed web origins", - "protocol" : "openid-connect", - "protocolMapper" : "oidc-allowed-origins-mapper", - "consentRequired" : false, - "config" : { } - } ] - }, { - "id" : "92cb2a60-3a1f-4bf1-94b9-078e80cff964", - "name" : "microprofile-jwt", - "description" : "Microprofile - JWT built-in scope", - "protocol" : "openid-connect", - "attributes" : { - "include.in.token.scope" : "true", - "display.on.consent.screen" : "false" + { + "id": "423fe6a4-3445-4731-8ac3-23e348b08743", + "alias": "Browser - Conditional OTP", + "description": "Flow to determine if the OTP is required for the authentication", + "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 + } + ] }, - "protocolMappers" : [ { - "id" : "1354aade-9a9f-41db-a462-f2071532fd6f", - "name" : "groups", - "protocol" : "openid-connect", - "protocolMapper" : "oidc-usermodel-realm-role-mapper", - "consentRequired" : false, - "config" : { - "multivalued" : "true", - "user.attribute" : "foo", - "id.token.claim" : "true", - "access.token.claim" : "true", - "claim.name" : "groups", - "jsonType.label" : "String" - } - }, { - "id" : "0e78dfa6-86dd-4960-a23b-44c3329df528", - "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" - } - } ] - } ], - "defaultDefaultClientScopes" : [ "role_list", "profile", "email", "roles", "web-origins" ], - "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, - "identityProviders" : [ ], - "identityProviderMappers" : [ ], - "components" : { - "org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy" : [ { - "id" : "a033e338-3cfe-4440-85dd-ec4a332742fd", - "name" : "Consent Required", - "providerId" : "consent-required", - "subType" : "anonymous", - "subComponents" : { }, - "config" : { } - }, { - "id" : "66eb3397-e784-4b4d-8242-5385453197b7", - "name" : "Allowed Protocol Mapper Types", - "providerId" : "allowed-protocol-mappers", - "subType" : "anonymous", - "subComponents" : { }, - "config" : { - "allowed-protocol-mapper-types" : [ "saml-user-attribute-mapper", "oidc-full-name-mapper", "oidc-usermodel-property-mapper", "oidc-usermodel-attribute-mapper", "saml-role-list-mapper", "oidc-sha256-pairwise-sub-mapper", "oidc-address-mapper", "saml-user-property-mapper" ] - } - }, { - "id" : "3e836a32-ff93-46e6-8e1f-7e320507388f", - "name" : "Allowed Client Scopes", - "providerId" : "allowed-client-templates", - "subType" : "authenticated", - "subComponents" : { }, - "config" : { - "allow-default-scopes" : [ "true" ] - } - }, { - "id" : "bad9c53c-6b7b-431f-a4f4-62970f9af1e2", - "name" : "Max Clients Limit", - "providerId" : "max-clients", - "subType" : "anonymous", - "subComponents" : { }, - "config" : { - "max-clients" : [ "200" ] - } - }, { - "id" : "174410e0-cd98-4a90-bfc3-68a8980b87e7", - "name" : "Allowed Client Scopes", - "providerId" : "allowed-client-templates", - "subType" : "anonymous", - "subComponents" : { }, - "config" : { - "allow-default-scopes" : [ "true" ] - } - }, { - "id" : "2b9ca142-85a0-448d-bde9-800f7823cac1", - "name" : "Trusted Hosts", - "providerId" : "trusted-hosts", - "subType" : "anonymous", - "subComponents" : { }, - "config" : { - "host-sending-registration-request-must-match" : [ "true" ], - "client-uris-must-match" : [ "true" ] - } - }, { - "id" : "4271132b-929b-4b76-a94e-aeafa71715ec", - "name" : "Full Scope Disabled", - "providerId" : "scope", - "subType" : "anonymous", - "subComponents" : { }, - "config" : { } - }, { - "id" : "6ab250a9-d27b-4c5c-8cdf-0b8adee370d4", - "name" : "Allowed Protocol Mapper Types", - "providerId" : "allowed-protocol-mappers", - "subType" : "authenticated", - "subComponents" : { }, - "config" : { - "allowed-protocol-mapper-types" : [ "oidc-usermodel-attribute-mapper", "saml-user-property-mapper", "oidc-usermodel-property-mapper", "oidc-full-name-mapper", "saml-user-attribute-mapper", "saml-role-list-mapper", "oidc-address-mapper", "oidc-sha256-pairwise-sub-mapper" ] - } - } ], - "org.keycloak.keys.KeyProvider" : [ { - "id" : "e7f99358-99f3-4fb6-a65d-5771a0c07f38", - "name" : "hmac-generated", - "providerId" : "hmac-generated", - "subComponents" : { }, - "config" : { - "kid" : [ "a7c0b05e-7852-492d-a712-30ce7c6e48a6" ], - "secret" : [ "gh6Ab3iAF2CiWam3ly0OZcwfMPRNn6s0lgqmn177iHBSebirfHRkahPjJGmGVHS9fmqRidaOV8v1YoxF0lhv5Q" ], - "priority" : [ "100" ], - "algorithm" : [ "HS256" ] - } - }, { - "id" : "30fe7115-b6e4-4ed8-b350-73a160895f4c", - "name" : "rsa-generated", - "providerId" : "rsa-generated", - "subComponents" : { }, - "config" : { - "privateKey" : [ "MIIEowIBAAKCAQEAnTsWCUKow1fwyn/p38MM7SfuS1KzDGGWPLcrt4r6Hy2vPG8G6psABbkA2+if5y+614vjLKaG2g33bU4OkoVOcGtISMN+Fc2J+i/Fd250PaLCe89uRzrHc2q+6bgMuvOnNtcOJqR+Y+Zrs34kG0izWe+dHTNrgav4WKbpKzAR3ZlCNIkVU81m2LG+u6MyQJpN3RiOaeBC/vtxCGHPO4BTHA4cCeXVd8P9Gczh5WqSH+Es5dQRxfLiWDLbV+BeAeDvJIhJq8yuLkjBBnq1w5TASVf8U+LsVVWCwUy/lDXDX7G2EVU+BRq9hfRPRkiXcN+CigZVr6b8JXdUH4Kh/PF2QwIDAQABAoIBAG1YLw4HnqgjW2DorjQgSLgRYgZeIAjHQR0+YZfGfgX61nhX2l6DpvNT4sYMtE+qAO1v6nAd64Bv4BfTBg1dydwir+VylxgAlik42cIiPZKzwz8pVc8RkK2ymcyeY7QMSMi5rKyxDvjYwSPV4LRczeYI3qH1JZnLh+3XPib7yiDqIQhMEPxxdOGzidwSwijTzVfOt5ltsk5T4ZCsGpWvoGnvNQYRlt4AdewGP0Mg0hacS21y5M6B1he+z9Tnb2/uIloGvEBHNCPsvn6qXmszoZhKH4FueP6cfgO4342jR8ksEhwlpgmAQ87B5zabMyRbstnazr1Am1dgCAQRto+xFXECgYEA3e8rqymsdVwnbjFsSv6K67SvnJdqFFHAcdzqeCoOsy0JBlb3ck9zvW/8R0dMx0YQ83dxlvKxCESOhroSHQ4P38N4t4CeOOSPhBnYFnfc3n75ckro1fp3WWL4Dq/oN63wiaNQCISz5HYdqXs9GXMVn5GRS8kr70qa3PrXY8RGa/sCgYEAtV1qcEoqMUVQGSYF3eWlXqTVn4RvonIg87Jw/dnaPnSUcy8+80+ipJiCInzRsZ+ApPNie+VStdg7mz0pDGkA9vqDX1SQYsp5XcCtq49Pt+Oc8woPowjY+rU8Us5v+BYM2RjAhO85+obsXkPchQsC+au6IODrA3awGHb5cuNyBFkCgYEAnbpqTbZLdAkvmNgVP+NR9hyvJlpSMOi9He9E0GwLkHn0TQYnzJz9A+h/4mShA4sfZvk/yGjpOpgGt2eskeu5im1Q8RG+4W5HNTps4eMEHTkerYThn5nnkqaM51tLba74IcnoinVNqJPtltMYZGrvNj3thnAOAn4CPAUmaShIaFsCgYAkWLpSEqruAOQShio61CEWHJarR1FQDutHq4U1eolgZuCxTNCi1lzT+7Ro0Pb9T+fqJtSf2899nf4kGFe3ovuMg5v8aOgexFEaVtj3PttNERKNKoEDvWwuok+akMCjyVd90pYSjhbifFO2eIcjKpfIDYBZwnmW0hxsaruHKMna0QKBgEYF8xk/XqDViV2a7C8byQNBXwFWzct+rcdj9yOMqdWl8XTBU7Tf2YojRKGjkpMHnrNbDCQPUYcKoIYZBWdkiufe5WTDU/3yLZjbMl+9jC9MQ3sXSZqWEqsdKDFZVFFXWNMxbmSPZMLWm3kWM0yxGg3e2il/NHpiNjssEz/toasC" ], - "certificate" : [ "MIICnTCCAYUCBgF4rE75SjANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDDAdxdWFya3VzMB4XDTIxMDQwNzEyMjc0MFoXDTMxMDQwNzEyMjkyMFowEjEQMA4GA1UEAwwHcXVhcmt1czCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ07FglCqMNX8Mp/6d/DDO0n7ktSswxhljy3K7eK+h8trzxvBuqbAAW5ANvon+cvuteL4yymhtoN921ODpKFTnBrSEjDfhXNifovxXdudD2iwnvPbkc6x3Nqvum4DLrzpzbXDiakfmPma7N+JBtIs1nvnR0za4Gr+Fim6SswEd2ZQjSJFVPNZtixvrujMkCaTd0YjmngQv77cQhhzzuAUxwOHAnl1XfD/RnM4eVqkh/hLOXUEcXy4lgy21fgXgHg7ySISavMri5IwQZ6tcOUwElX/FPi7FVVgsFMv5Q1w1+xthFVPgUavYX0T0ZIl3DfgooGVa+m/CV3VB+CofzxdkMCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEACWVoMh1jB64LEiOzHrwDWeWDHRZMrb1TBcfC6ALjFDBako0AbSHxBqN6FJgN6C3BhzCBcI4LR6I8bpqGuZ9y9zE8hRj8oAtEAXnPdMSWsWEBBFdbSBDeBE9Q8jXJ5LCk+Iz/5HcPJTgUpkJdKmzIWqp1hI4zOb1+GZrERg04Ue+xP6DTCOZkcofA3twzqM0Eifig8UoSUlejUKXCISbcO39slcFNGbPDPsUNjWUgVG79TZExtF02KmbzEifh+aQi0jb3/d5gSPEOSW+n8CC/zW0woDZQ4ZhspDUeQyIafy0JPlgZljsWBbWpJ0ZJIiWVTWxO7T1ogiyFtLoX2sinJA==" ], - "priority" : [ "100" ] + { + "id": "c60ff278-6c63-4d7e-ad1c-7c4e825199a6", + "alias": "Direct Grant - Conditional OTP", + "description": "Flow to determine if the OTP is required for the authentication", + "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": "d5bde955-3a6e-47d2-9289-fdd28e1d1c45", + "alias": "First broker login - Conditional OTP", + "description": "Flow to determine if the OTP is required for the authentication", + "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": "2fc18574-8dc9-4a4f-9dbf-f7b221a978bc", + "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 + }, + { + "requirement": "REQUIRED", + "priority": 20, + "flowAlias": "Account verification options", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "306c3c73-3d32-44ce-8781-e2cde85d7823", + "alias": "Reset - Conditional OTP", + "description": "Flow to determine if the OTP should be reset or not. Set to REQUIRED to force.", + "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": "ee1b35cd-1378-4d4d-b47b-f769afafb8a8", + "alias": "User creation or linking", + "description": "Flow for the existing/non-existing user alternatives", + "providerId": "basic-flow", + "topLevel": false, + "builtIn": true, + "authenticationExecutions": [ + { + "authenticatorConfig": "create unique user config", + "authenticator": "idp-create-user-if-unique", + "requirement": "ALTERNATIVE", + "priority": 10, + "userSetupAllowed": false, + "autheticatorFlow": false + }, + { + "requirement": "ALTERNATIVE", + "priority": 20, + "flowAlias": "Handle Existing Account", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "3c4a0468-ac42-4f2c-9fc5-34520bac4645", + "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": "First broker login - Conditional OTP", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "8115c879-0792-4557-896c-91a529d68cf6", + "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": "a407f9a2-8671-4fe0-b5c6-03e29e115337", + "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": "0f232cb6-6904-4c1f-948e-e221300fa518", + "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 - Conditional OTP", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "a57ab792-c919-4f99-b662-a4e142d7c035", + "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": "d0327c66-d41e-45d1-898c-0dae3dc3a149", + "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 + }, + { + "requirement": "REQUIRED", + "priority": 20, + "flowAlias": "User creation or linking", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "7af247e0-a6b9-4fed-857d-d14258acd2b8", + "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": "Browser - Conditional OTP", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "12c84fcd-ed90-4b34-b8be-5208945939ef", + "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 + }, + { + "requirement": "REQUIRED", + "priority": 20, + "flowAlias": "Authentication Options", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "c2c34d02-e57f-4341-8c05-272b5fef9f60", + "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": "ee5eb12c-033b-481b-9a91-466f3bc02581", + "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": "320a7e68-e3ab-4142-a660-e2a25a434287", + "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 - Conditional OTP", + "userSetupAllowed": false, + "autheticatorFlow": true + } + ] + }, + { + "id": "1ad6cd70-f740-4411-bd1c-35628d7878b3", + "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": "9e1bf425-f911-41fe-b17e-0217b929bc22", + "alias": "create unique user config", + "config": { + "require.password.update.after.registration": "false" } - }, { - "id" : "1d927d6c-779e-4fea-a2a4-a3dd194c1a8f", - "name" : "aes-generated", - "providerId" : "aes-generated", - "subComponents" : { }, - "config" : { - "kid" : [ "12395eb8-d68a-4272-b88e-3e2a2096e2e6" ], - "secret" : [ "uqAMrTEXiIXom7DjxnnWEw" ], - "priority" : [ "100" ] + }, + { + "id": "7fa0e793-a298-4584-a629-f206a1f33944", + "alias": "review profile config", + "config": { + "update.profile.on.first.login": "missing" } - } ] - }, - "internationalizationEnabled" : false, - "supportedLocales" : [ ], - "authenticationFlows" : [ { - "id" : "0b0bb974-6484-4dbc-bc0c-7a3ce27a1a2f", - "alias" : "Account verification options", - "description" : "Method with which to verity the existing account", - "providerId" : "basic-flow", - "topLevel" : false, - "builtIn" : true, - "authenticationExecutions" : [ { - "authenticator" : "idp-email-verification", - "requirement" : "ALTERNATIVE", - "priority" : 10, - "userSetupAllowed" : false, - "autheticatorFlow" : false - }, { - "requirement" : "ALTERNATIVE", - "priority" : 20, - "flowAlias" : "Verify Existing Account by Re-authentication", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "b7f60e5e-94c8-4ede-ab61-ced8b2fea44a", - "alias" : "Authentication Options", - "description" : "Authentication options.", - "providerId" : "basic-flow", - "topLevel" : false, - "builtIn" : true, - "authenticationExecutions" : [ { - "authenticator" : "basic-auth", - "requirement" : "REQUIRED", - "priority" : 10, - "userSetupAllowed" : false, - "autheticatorFlow" : false - }, { - "authenticator" : "basic-auth-otp", - "requirement" : "DISABLED", - "priority" : 20, - "userSetupAllowed" : false, - "autheticatorFlow" : false - }, { - "authenticator" : "auth-spnego", - "requirement" : "DISABLED", - "priority" : 30, - "userSetupAllowed" : false, - "autheticatorFlow" : false - } ] - }, { - "id" : "423fe6a4-3445-4731-8ac3-23e348b08743", - "alias" : "Browser - Conditional OTP", - "description" : "Flow to determine if the OTP is required for the authentication", - "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" : "c60ff278-6c63-4d7e-ad1c-7c4e825199a6", - "alias" : "Direct Grant - Conditional OTP", - "description" : "Flow to determine if the OTP is required for the authentication", - "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" : "d5bde955-3a6e-47d2-9289-fdd28e1d1c45", - "alias" : "First broker login - Conditional OTP", - "description" : "Flow to determine if the OTP is required for the authentication", - "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" : "2fc18574-8dc9-4a4f-9dbf-f7b221a978bc", - "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 - }, { - "requirement" : "REQUIRED", - "priority" : 20, - "flowAlias" : "Account verification options", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "306c3c73-3d32-44ce-8781-e2cde85d7823", - "alias" : "Reset - Conditional OTP", - "description" : "Flow to determine if the OTP should be reset or not. Set to REQUIRED to force.", - "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" : "ee1b35cd-1378-4d4d-b47b-f769afafb8a8", - "alias" : "User creation or linking", - "description" : "Flow for the existing/non-existing user alternatives", - "providerId" : "basic-flow", - "topLevel" : false, - "builtIn" : true, - "authenticationExecutions" : [ { - "authenticatorConfig" : "create unique user config", - "authenticator" : "idp-create-user-if-unique", - "requirement" : "ALTERNATIVE", - "priority" : 10, - "userSetupAllowed" : false, - "autheticatorFlow" : false - }, { - "requirement" : "ALTERNATIVE", - "priority" : 20, - "flowAlias" : "Handle Existing Account", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "3c4a0468-ac42-4f2c-9fc5-34520bac4645", - "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" : "First broker login - Conditional OTP", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "8115c879-0792-4557-896c-91a529d68cf6", - "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" : "a407f9a2-8671-4fe0-b5c6-03e29e115337", - "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" : "0f232cb6-6904-4c1f-948e-e221300fa518", - "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 - Conditional OTP", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "a57ab792-c919-4f99-b662-a4e142d7c035", - "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" : "d0327c66-d41e-45d1-898c-0dae3dc3a149", - "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 - }, { - "requirement" : "REQUIRED", - "priority" : 20, - "flowAlias" : "User creation or linking", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "7af247e0-a6b9-4fed-857d-d14258acd2b8", - "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" : "Browser - Conditional OTP", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "12c84fcd-ed90-4b34-b8be-5208945939ef", - "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 - }, { - "requirement" : "REQUIRED", - "priority" : 20, - "flowAlias" : "Authentication Options", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "c2c34d02-e57f-4341-8c05-272b5fef9f60", - "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" : "ee5eb12c-033b-481b-9a91-466f3bc02581", - "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" : "320a7e68-e3ab-4142-a660-e2a25a434287", - "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 - Conditional OTP", - "userSetupAllowed" : false, - "autheticatorFlow" : true - } ] - }, { - "id" : "1ad6cd70-f740-4411-bd1c-35628d7878b3", - "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" : "9e1bf425-f911-41fe-b17e-0217b929bc22", - "alias" : "create unique user config", - "config" : { - "require.password.update.after.registration" : "false" } - }, { - "id" : "7fa0e793-a298-4584-a629-f206a1f33944", - "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": {} + }, + { + "alias": "delete_account", + "name": "Delete Account", + "providerId": "delete_account", + "enabled": false, + "defaultAction": false, + "priority": 60, + "config": {} + }, + { + "alias": "update_user_locale", + "name": "Update User Locale", + "providerId": "update_user_locale", + "enabled": true, + "defaultAction": false, + "priority": 1000, + "config": {} } - } ], - "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" : { } - }, { - "alias" : "delete_account", - "name" : "Delete Account", - "providerId" : "delete_account", - "enabled" : false, - "defaultAction" : false, - "priority" : 60, - "config" : { } - }, { - "alias" : "update_user_locale", - "name" : "Update User Locale", - "providerId" : "update_user_locale", - "enabled" : true, - "defaultAction" : false, - "priority" : 1000, - "config" : { } - } ], - "browserFlow" : "browser", - "registrationFlow" : "registration", - "directGrantFlow" : "direct grant", - "resetCredentialsFlow" : "reset credentials", - "clientAuthenticationFlow" : "clients", - "dockerAuthenticationFlow" : "docker auth", - "attributes" : { - "clientOfflineSessionMaxLifespan" : "0", - "clientSessionIdleTimeout" : "0", - "clientSessionMaxLifespan" : "0", - "clientOfflineSessionIdleTimeout" : "0" + ], + "browserFlow": "browser", + "registrationFlow": "registration", + "directGrantFlow": "direct grant", + "resetCredentialsFlow": "reset credentials", + "clientAuthenticationFlow": "clients", + "dockerAuthenticationFlow": "docker auth", + "attributes": { + "clientOfflineSessionMaxLifespan": "0", + "clientSessionIdleTimeout": "0", + "clientSessionMaxLifespan": "0", + "clientOfflineSessionIdleTimeout": "0" }, - "keycloakVersion" : "12.0.1", - "userManagedAccessAllowed" : false + "keycloakVersion": "12.0.1", + "userManagedAccessAllowed": false } \ No newline at end of file diff --git a/cart/src/main/java/com/yas/cart/config/CorsConfig.java b/cart/src/main/java/com/yas/cart/config/CorsConfig.java index ff9085c130..87af701f45 100644 --- a/cart/src/main/java/com/yas/cart/config/CorsConfig.java +++ b/cart/src/main/java/com/yas/cart/config/CorsConfig.java @@ -13,7 +13,7 @@ public WebMvcConfigurer corsConfigure() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").allowedMethods("*").allowedOrigins("*") - .allowedHeaders("*"); + .allowedHeaders("*"); } }; } diff --git a/cart/src/main/java/com/yas/cart/config/SwaggerConfig.java b/cart/src/main/java/com/yas/cart/config/SwaggerConfig.java index 78e439d8dd..6ee7cf309e 100644 --- a/cart/src/main/java/com/yas/cart/config/SwaggerConfig.java +++ b/cart/src/main/java/com/yas/cart/config/SwaggerConfig.java @@ -12,10 +12,11 @@ @OpenAPIDefinition(info = @Info(title = "Product Service API", description = "Product API documentation", version = "1.0"), security = @SecurityRequirement(name = "oauth2_bearer"), - servers = {@Server(url = "${server.servlet.context-path}", description = "Default Server URL")}) + servers = {@Server(url = "${server.servlet.context-path}", description = "Default Server URL")}) @SecurityScheme(name = "oauth2_bearer", type = SecuritySchemeType.OAUTH2, - flows = @OAuthFlows(authorizationCode = @OAuthFlow(authorizationUrl = "${springdoc.oauthflow.authorization-url}", + flows = @OAuthFlows(authorizationCode = @OAuthFlow( + authorizationUrl = "${springdoc.oauthflow.authorization-url}", tokenUrl = "${springdoc.oauthflow.token-url}", scopes = { - @OAuthScope(name = "openid", description = "openid")}))) + @OAuthScope(name = "openid", description = "openid")}))) public class SwaggerConfig { } diff --git a/cart/src/main/java/com/yas/cart/exception/ApiExceptionHandler.java b/cart/src/main/java/com/yas/cart/exception/ApiExceptionHandler.java index c4b6155c24..96eb889dae 100644 --- a/cart/src/main/java/com/yas/cart/exception/ApiExceptionHandler.java +++ b/cart/src/main/java/com/yas/cart/exception/ApiExceptionHandler.java @@ -1,6 +1,8 @@ package com.yas.cart.exception; import com.yas.cart.viewmodel.ErrorVm; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; import java.util.List; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; diff --git a/cart/src/main/java/com/yas/cart/exception/BadRequestException.java b/cart/src/main/java/com/yas/cart/exception/BadRequestException.java deleted file mode 100644 index cf87717bd7..0000000000 --- a/cart/src/main/java/com/yas/cart/exception/BadRequestException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yas.cart.exception; - -import com.yas.cart.utils.MessagesUtils; - -public class BadRequestException extends RuntimeException { - private String message; - - public BadRequestException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/cart/src/main/java/com/yas/cart/exception/NotFoundException.java b/cart/src/main/java/com/yas/cart/exception/NotFoundException.java deleted file mode 100644 index 958fecea74..0000000000 --- a/cart/src/main/java/com/yas/cart/exception/NotFoundException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yas.cart.exception; - -import com.yas.cart.utils.MessagesUtils; - -public class NotFoundException extends RuntimeException { - - private String message; - - public NotFoundException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/cart/src/main/java/com/yas/cart/service/CartService.java b/cart/src/main/java/com/yas/cart/service/CartService.java index c70bfc6847..24c7b81c38 100644 --- a/cart/src/main/java/com/yas/cart/service/CartService.java +++ b/cart/src/main/java/com/yas/cart/service/CartService.java @@ -1,7 +1,5 @@ package com.yas.cart.service; -import com.yas.cart.exception.BadRequestException; -import com.yas.cart.exception.NotFoundException; import com.yas.cart.model.Cart; import com.yas.cart.model.CartItem; import com.yas.cart.repository.CartItemRepository; @@ -13,6 +11,8 @@ import com.yas.cart.viewmodel.CartItemVm; import com.yas.cart.viewmodel.CartListVm; import com.yas.cart.viewmodel.ProductThumbnailVm; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; import java.time.ZonedDateTime; import java.util.HashSet; import java.util.List; diff --git a/cart/src/main/java/com/yas/cart/utils/MessagesUtils.java b/cart/src/main/java/com/yas/cart/utils/MessagesUtils.java deleted file mode 100644 index 8eeb155ad7..0000000000 --- a/cart/src/main/java/com/yas/cart/utils/MessagesUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.yas.cart.utils; - -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; -import org.slf4j.helpers.FormattingTuple; -import org.slf4j.helpers.MessageFormatter; - -public class MessagesUtils { - - static ResourceBundle messageBundle = ResourceBundle.getBundle("messages.messages", Locale.getDefault()); - - public static String getMessage(String errorCode, Object... var2) { - String message; - try { - message = messageBundle.getString(errorCode); - } catch (MissingResourceException ex) { - // case message_code is not defined. - message = errorCode; - } - FormattingTuple formattingTuple = MessageFormatter.arrayFormat(message, var2); - return formattingTuple.getMessage(); - } -} diff --git a/cart/src/main/java/com/yas/cart/viewmodel/CartDetailVm.java b/cart/src/main/java/com/yas/cart/viewmodel/CartDetailVm.java index 16f68cc681..d9e3e21f3b 100644 --- a/cart/src/main/java/com/yas/cart/viewmodel/CartDetailVm.java +++ b/cart/src/main/java/com/yas/cart/viewmodel/CartDetailVm.java @@ -5,8 +5,8 @@ public record CartDetailVm(Long id, Long productId, int quantity) { public static CartDetailVm fromModel(CartItem cartItem) { return new CartDetailVm( - cartItem.getId(), - cartItem.getProductId(), - cartItem.getQuantity()); + cartItem.getId(), + cartItem.getProductId(), + cartItem.getQuantity()); } } diff --git a/cart/src/main/java/com/yas/cart/viewmodel/CartPostVm.java b/cart/src/main/java/com/yas/cart/viewmodel/CartPostVm.java index 0ff3ee0a97..58f4ceab56 100644 --- a/cart/src/main/java/com/yas/cart/viewmodel/CartPostVm.java +++ b/cart/src/main/java/com/yas/cart/viewmodel/CartPostVm.java @@ -4,5 +4,5 @@ public record CartPostVm( - List cartItemVm) { + List cartItemVm) { } diff --git a/cart/src/main/java/com/yas/cart/viewmodel/ResponeStatusVm.java b/cart/src/main/java/com/yas/cart/viewmodel/ResponeStatusVm.java index 50e43669bc..6e6057c033 100644 --- a/cart/src/main/java/com/yas/cart/viewmodel/ResponeStatusVm.java +++ b/cart/src/main/java/com/yas/cart/viewmodel/ResponeStatusVm.java @@ -1,4 +1,4 @@ package com.yas.cart.viewmodel; -public record ResponeStatusVm(String title, String message, String statusCode){ +public record ResponeStatusVm(String title, String message, String statusCode) { } diff --git a/cart/src/main/resources/application.properties b/cart/src/main/resources/application.properties index 3e3bfff389..fa342b60c8 100644 --- a/cart/src/main/resources/application.properties +++ b/cart/src/main/resources/application.properties @@ -1,37 +1,26 @@ server.port=8084 server.servlet.context-path=/cart - spring.application.name=cart spring.threads.virtual.enabled=true -management.tracing.sampling.probability=1.0 management.endpoints.web.exposure.include=* management.metrics.distribution.percentiles-histogram.http.server.requests=true management.metrics.tags.application=${spring.application.name} - logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}] - spring.security.oauth2.resourceserver.jwt.issuer-uri=http://identity/realms/Yas - yas.services.media=http://api.yas.local/media yas.services.product=http://api.yas.local/product - spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.url=jdbc:postgresql://localhost:5432/cart spring.datasource.username=admin spring.datasource.password=admin - # The SQL dialect makes Hibernate generate better SQL for the chosen database -spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect - +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect # Hibernate ddl auto (none, create, create-drop, validate, update) -spring.jpa.hibernate.ddl-auto = none - +spring.jpa.hibernate.ddl-auto=none # Disable open in view transaction spring.jpa.open-in-view=false - #Enable liquibase spring.liquibase.enabled=true - # swagger-ui custom path springdoc.swagger-ui.path=/swagger-ui springdoc.packagesToScan=com.yas.cart @@ -39,9 +28,7 @@ springdoc.swagger-ui.oauth.use-pkce-with-authorization-code-grant=true springdoc.swagger-ui.oauth.client-id=swagger-ui springdoc.oauthflow.authorization-url=http://identity/realms/Yas/protocol/openid-connect/auth springdoc.oauthflow.token-url=http://identity/realms/Yas/protocol/openid-connect/token - resilience4j.retry.instances.rest-api.max-attempts=3 - resilience4j.circuitbreaker.instances.rest-circuit-breaker.sliding-window-type=COUNT_BASED resilience4j.circuitbreaker.instances.rest-circuit-breaker.failure-rate-threshold=50 resilience4j.circuitbreaker.instances.rest-circuit-breaker.minimum-number-of-calls=5 diff --git a/cart/src/main/resources/logback-spring.xml b/cart/src/main/resources/logback-spring.xml index e9b3c157ca..1696eaf750 100644 --- a/cart/src/main/resources/logback-spring.xml +++ b/cart/src/main/resources/logback-spring.xml @@ -1,27 +1,27 @@ - - - - - - - + + + + + + + - - ${user-system}.out - - ${CONSOLE_LOG_PATTERN} - ${ENCODING} - - + + ${user-system}.out + + ${CONSOLE_LOG_PATTERN} + ${ENCODING} + + - - - + + + diff --git a/cart/src/main/resources/messages/messages.properties b/cart/src/main/resources/messages/messages.properties index 48c89ef4f3..06343afafe 100644 --- a/cart/src/main/resources/messages/messages.properties +++ b/cart/src/main/resources/messages/messages.properties @@ -1,7 +1,7 @@ -CART_ITEM_CANT_NULL = Cart's item can't be null -QUANTITY_CANT_NEGATIVE = Quantity cannot be negative -NOT_FOUND_PRODUCT = Not found product {} -NOT_FOUND_CART = Not found cart {} -NOT_EXISTING_ITEM_IN_CART = There is no cart item in current cart to update! -NOT_EXISTING_PRODUCT_IN_CART = There is no product with ID: {} in the current cart -NON_EXISTING_CART_ITEM = Non exist cart item with ID: {} +CART_ITEM_CANT_NULL=Cart's item can't be null +QUANTITY_CANT_NEGATIVE=Quantity cannot be negative +NOT_FOUND_PRODUCT=Not found product {} +NOT_FOUND_CART=Not found cart {} +NOT_EXISTING_ITEM_IN_CART=There is no cart item in current cart to update! +NOT_EXISTING_PRODUCT_IN_CART=There is no product with ID: {} in the current cart +NON_EXISTING_CART_ITEM=Non exist cart item with ID: {} diff --git a/cart/src/test/java/com/yas/cart/controller/CartControllerTest.java b/cart/src/test/java/com/yas/cart/controller/CartControllerTest.java index 72658a0236..9e655fe819 100644 --- a/cart/src/test/java/com/yas/cart/controller/CartControllerTest.java +++ b/cart/src/test/java/com/yas/cart/controller/CartControllerTest.java @@ -8,14 +8,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; import com.yas.cart.CartApplication; -import com.yas.cart.exception.BadRequestException; -import com.yas.cart.exception.NotFoundException; import com.yas.cart.service.CartService; import com.yas.cart.utils.Constants; import com.yas.cart.viewmodel.CartGetDetailVm; import com.yas.cart.viewmodel.CartItemPutVm; import com.yas.cart.viewmodel.CartItemVm; import com.yas.cart.viewmodel.CartListVm; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; import java.security.Principal; import java.util.Collections; import java.util.List; @@ -60,7 +60,7 @@ void testListCarts() throws Exception { when(cartService.getCarts()).thenReturn(cartList); mockMvc.perform(MockMvcRequestBuilders.get("/backoffice/carts") - .accept("application/json")) + .accept("application/json")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().json(objectWriter.writeValueAsString(cartList))); } @@ -75,7 +75,7 @@ void testListCartDetailByCustomerId() throws Exception { when(cartService.getCartDetailByCustomerId(customerId)).thenReturn(cartDetailList); mockMvc.perform(MockMvcRequestBuilders.get("/backoffice/carts/{customerId}", customerId) - .accept("application/json")) + .accept("application/json")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().json(objectWriter.writeValueAsString(cartDetailList))); } @@ -91,8 +91,8 @@ void testGetLastCartWithPrincipal() throws Exception { when(principal.getName()).thenReturn(username); mockMvc.perform(MockMvcRequestBuilders.get("/storefront/carts") - .principal(principal) - .accept("application/json")) + .principal(principal) + .accept("application/json")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().json(objectWriter.writeValueAsString(cartGetDetailVm))); } @@ -101,7 +101,7 @@ void testGetLastCartWithPrincipal() throws Exception { void testGetLastCartWithNoPrincipal() throws Exception { // Act & Assert mockMvc.perform(MockMvcRequestBuilders.get("/storefront/carts") - .accept("application/json")) + .accept("application/json")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().string("")); } @@ -115,10 +115,10 @@ void testCreateCartSuccess() throws Exception { when(cartService.addToCart(cartItemVms)).thenReturn(cartGetDetailVm); mockMvc.perform(MockMvcRequestBuilders.post("/storefront/carts") - .contentType("application/json") - .content(objectWriter.writeValueAsString(cartItemVms))) - .andExpect(MockMvcResultMatchers.status().isCreated()) - .andExpect(MockMvcResultMatchers.content().json(objectWriter.writeValueAsString(cartGetDetailVm))); + .contentType("application/json") + .content(objectWriter.writeValueAsString(cartItemVms))) + .andExpect(MockMvcResultMatchers.status().isCreated()) + .andExpect(MockMvcResultMatchers.content().json(objectWriter.writeValueAsString(cartGetDetailVm))); } @Test @@ -127,11 +127,11 @@ void testCreateCartNotFound() throws Exception { List cartItemVms = List.of(new CartItemVm(4L, 6, 1L)); when(cartService.addToCart(cartItemVms)) - .thenThrow(new NotFoundException(Constants.ErrorCode.NOT_FOUND_PRODUCT)); + .thenThrow(new NotFoundException(Constants.ErrorCode.NOT_FOUND_PRODUCT)); mockMvc.perform(MockMvcRequestBuilders.post("/storefront/carts") - .contentType("application/json") - .content(objectWriter.writeValueAsString(cartItemVms))) + .contentType("application/json") + .content(objectWriter.writeValueAsString(cartItemVms))) .andExpect(MockMvcResultMatchers.status().isNotFound()); } @@ -143,8 +143,8 @@ void testCreateCartBadRequest() throws Exception { when(cartService.addToCart(cartItemVms)).thenThrow(new BadRequestException("Not Found")); mockMvc.perform(MockMvcRequestBuilders.post("/storefront/carts") - .contentType("application/json") - .content(objectWriter.writeValueAsString(cartItemVms))) + .contentType("application/json") + .content(objectWriter.writeValueAsString(cartItemVms))) .andExpect(MockMvcResultMatchers.status().isBadRequest()); } @@ -162,8 +162,8 @@ void testUpdateCartSuccess() throws Exception { // Act & Assert mockMvc.perform(MockMvcRequestBuilders.put("/cart-item") - .contentType("application/json") - .content(objectWriter.writeValueAsString(cartItemVm))) + .contentType("application/json") + .content(objectWriter.writeValueAsString(cartItemVm))) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().json(objectWriter.writeValueAsString(cartItemPutVm))); } @@ -179,8 +179,8 @@ void testRemoveCartItemSuccess() throws Exception { setUpSecurityContext(username); mockMvc.perform(MockMvcRequestBuilders.delete("/storefront/cart-item") - .param("productId", productId.toString()) - .accept("application/json")) + .param("productId", productId.toString()) + .accept("application/json")) .andExpect(MockMvcResultMatchers.status().isNoContent()); } @@ -195,8 +195,8 @@ void testRemoveCartItemListSuccess() throws Exception { setUpSecurityContext(username); mockMvc.perform(MockMvcRequestBuilders.delete("/storefront/cart-item/multi-delete") - .param("productIds", productIds.stream().map(String::valueOf).toArray(String[]::new)) - .accept("application/json")) + .param("productIds", productIds.stream().map(String::valueOf).toArray(String[]::new)) + .accept("application/json")) .andExpect(MockMvcResultMatchers.status().isNoContent()); } @@ -214,8 +214,8 @@ void testGetNumberItemInCartSuccess() throws Exception { setUpSecurityContext(username); mockMvc.perform(MockMvcRequestBuilders.get("/storefront/count-cart-items") - .principal(principal) - .accept("application/json")) + .principal(principal) + .accept("application/json")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().string(itemCount.toString())); } @@ -231,7 +231,7 @@ void testGetNumberItemInCartWhenNoItems() throws Exception { setUpSecurityContext(username); mockMvc.perform(MockMvcRequestBuilders.get("/storefront/count-cart-items") - .accept("application/json")) + .accept("application/json")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().string(itemCount.toString())); } diff --git a/cart/src/test/java/com/yas/cart/service/ProductServiceTest.java b/cart/src/test/java/com/yas/cart/service/ProductServiceTest.java index dd3173bfca..f288445ba7 100644 --- a/cart/src/test/java/com/yas/cart/service/ProductServiceTest.java +++ b/cart/src/test/java/com/yas/cart/service/ProductServiceTest.java @@ -52,7 +52,8 @@ void getProducts_NormalCase_ReturnProductThumbnailVms() { when(restClient.get()).thenReturn(requestHeadersUriSpec); when(requestHeadersUriSpec.uri(url)).thenReturn(requestHeadersUriSpec); when(requestHeadersUriSpec.retrieve()).thenReturn(responseSpec); - when(responseSpec.toEntity(new ParameterizedTypeReference>() {})) + when(responseSpec.toEntity(new ParameterizedTypeReference>() { + })) .thenReturn(ResponseEntity.ok(getProductThumbnailVms())); List result = productService.getProducts(ids); diff --git a/cart/src/test/resources/application.properties b/cart/src/test/resources/application.properties index 7e1b6786cd..7b588357de 100644 --- a/cart/src/test/resources/application.properties +++ b/cart/src/test/resources/application.properties @@ -1,13 +1,10 @@ # Setting Spring context path & port server.servlet.context-path=/v1 server.port=8084 - spring.jpa.hibernate.ddl-auto=update spring.liquibase.enabled=false - # Setting Spring profile spring.profiles.active=test - spring.security.oauth2.resourceserver.jwt.issuer-uri=test springdoc.oauthflow.authorization-url=test springdoc.oauthflow.token-url=test \ No newline at end of file diff --git a/cart/src/test/resources/logback-spring.xml b/cart/src/test/resources/logback-spring.xml index 0bf554c884..85e5ec6dbd 100644 --- a/cart/src/test/resources/logback-spring.xml +++ b/cart/src/test/resources/logback-spring.xml @@ -1,6 +1,6 @@ - + diff --git a/common-library/pom.xml b/common-library/pom.xml new file mode 100644 index 0000000000..5c78077350 --- /dev/null +++ b/common-library/pom.xml @@ -0,0 +1,55 @@ + + + 4.0.0 + + com.yas + yas + ${revision} + ../pom.xml + + common-library + 1.0-SNAPSHOT + jar + + Common Library + YAS Common Library service + + + nashtech-garage + https://sonarcloud.io + nashtech-garage_yas-common-library + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-oauth2-authorization-server + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-aop + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.jacoco + jacoco-maven-plugin + + + + + \ No newline at end of file diff --git a/common-library/src/main/java/com/yas/commonlibrary/CommonLibraryApplication.java b/common-library/src/main/java/com/yas/commonlibrary/CommonLibraryApplication.java new file mode 100644 index 0000000000..09bd29eaf1 --- /dev/null +++ b/common-library/src/main/java/com/yas/commonlibrary/CommonLibraryApplication.java @@ -0,0 +1,15 @@ +package com.yas.commonlibrary; + +import com.yas.commonlibrary.config.ServiceUrlConfig; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; + +@SpringBootApplication +@EnableConfigurationProperties(ServiceUrlConfig.class) +public class CommonLibraryApplication { + + public static void main(String[] args) { + SpringApplication.run(CommonLibraryApplication.class, args); + } +} \ No newline at end of file diff --git a/common-library/src/main/java/com/yas/commonlibrary/config/ServiceUrlConfig.java b/common-library/src/main/java/com/yas/commonlibrary/config/ServiceUrlConfig.java new file mode 100644 index 0000000000..24930e89e7 --- /dev/null +++ b/common-library/src/main/java/com/yas/commonlibrary/config/ServiceUrlConfig.java @@ -0,0 +1,7 @@ +package com.yas.commonlibrary.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "yas.services") +public record ServiceUrlConfig(String media, String product) { +} diff --git a/common-library/src/main/java/com/yas/commonlibrary/constants/ApiConstant.java b/common-library/src/main/java/com/yas/commonlibrary/constants/ApiConstant.java new file mode 100644 index 0000000000..1a08987974 --- /dev/null +++ b/common-library/src/main/java/com/yas/commonlibrary/constants/ApiConstant.java @@ -0,0 +1,23 @@ +package com.yas.commonlibrary.constants; + +public final class ApiConstant { + public static final String WAREHOUSE_URL = "/backoffice/warehouses"; + public static final String STOCK_HISTORY_URL = "/backoffice/stocks/histories"; + public static final String STOCK_URL = "/backoffice/stocks"; + public static final String CODE_200 = "200"; + public static final String OK = "Ok"; + public static final String CODE_404 = "404"; + public static final String NOT_FOUND = "Not found"; + public static final String CODE_201 = "201"; + public static final String CREATED = "Created"; + public static final String CODE_400 = "400"; + public static final String BAD_REQUEST = "Bad request"; + public static final String CODE_204 = "204"; + public static final String NO_CONTENT = "No content"; + public static final String ACCESS_DENIED = "ACCESS_DENIED"; + public static final String INVALID_ADJUSTED_QUANTITY = "INVALID_ADJUSTED_QUANTITY"; + + private ApiConstant() { + //Add constructor + } +} diff --git a/common-library/src/main/java/com/yas/commonlibrary/constants/MessageCode.java b/common-library/src/main/java/com/yas/commonlibrary/constants/MessageCode.java new file mode 100644 index 0000000000..8c47df9cc1 --- /dev/null +++ b/common-library/src/main/java/com/yas/commonlibrary/constants/MessageCode.java @@ -0,0 +1,10 @@ +package com.yas.commonlibrary.constants; + +public final class MessageCode { + public static final String WAREHOUSE_NOT_FOUND = "WAREHOUSE_NOT_FOUND"; + public static final String PRODUCT_NOT_FOUND = "PRODUCT_NOT_FOUND"; + public static final String NAME_ALREADY_EXITED = "NAME_ALREADY_EXITED"; + private MessageCode() { + //Add constructor + } +} diff --git a/common-library/src/main/java/com/yas/commonlibrary/constants/PageableConstant.java b/common-library/src/main/java/com/yas/commonlibrary/constants/PageableConstant.java new file mode 100644 index 0000000000..eb20421900 --- /dev/null +++ b/common-library/src/main/java/com/yas/commonlibrary/constants/PageableConstant.java @@ -0,0 +1,9 @@ +package com.yas.commonlibrary.constants; + +public final class PageableConstant { + public static final String DEFAULT_PAGE_SIZE = "10"; + public static final String DEFAULT_PAGE_NUMBER = "0"; + private PageableConstant() { + //Add constructor + } +} diff --git a/inventory/src/main/java/com/yas/inventory/exception/AccessDeniedException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/AccessDeniedException.java similarity index 78% rename from inventory/src/main/java/com/yas/inventory/exception/AccessDeniedException.java rename to common-library/src/main/java/com/yas/commonlibrary/exception/AccessDeniedException.java index b45bdf8b43..61afe6c499 100644 --- a/inventory/src/main/java/com/yas/inventory/exception/AccessDeniedException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/AccessDeniedException.java @@ -1,4 +1,4 @@ -package com.yas.inventory.exception; +package com.yas.commonlibrary.exception; public class AccessDeniedException extends RuntimeException { public AccessDeniedException(final String message) { diff --git a/product/src/main/java/com/yas/product/exception/BadRequestException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/BadRequestException.java similarity index 84% rename from product/src/main/java/com/yas/product/exception/BadRequestException.java rename to common-library/src/main/java/com/yas/commonlibrary/exception/BadRequestException.java index c8a0821a8c..ffe39ea683 100644 --- a/product/src/main/java/com/yas/product/exception/BadRequestException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/BadRequestException.java @@ -1,6 +1,6 @@ -package com.yas.product.exception; +package com.yas.commonlibrary.exception; -import com.yas.product.utils.MessagesUtils; +import com.yas.commonlibrary.utils.MessagesUtils; public class BadRequestException extends RuntimeException { diff --git a/common-library/src/main/java/com/yas/commonlibrary/exception/CreateGuestUserException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/CreateGuestUserException.java new file mode 100644 index 0000000000..0a6045ebdb --- /dev/null +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/CreateGuestUserException.java @@ -0,0 +1,7 @@ +package com.yas.commonlibrary.exception; + +public class CreateGuestUserException extends RuntimeException { + public CreateGuestUserException(final String message) { + super(message); + } +} diff --git a/location/src/main/java/com/yas/location/exception/DuplicatedException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/DuplicatedException.java similarity index 81% rename from location/src/main/java/com/yas/location/exception/DuplicatedException.java rename to common-library/src/main/java/com/yas/commonlibrary/exception/DuplicatedException.java index 6c51340ff6..80f0595784 100644 --- a/location/src/main/java/com/yas/location/exception/DuplicatedException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/DuplicatedException.java @@ -1,6 +1,6 @@ -package com.yas.location.exception; +package com.yas.commonlibrary.exception; -import com.yas.location.utils.MessagesUtils; +import com.yas.commonlibrary.utils.MessagesUtils; public class DuplicatedException extends RuntimeException { diff --git a/product/src/main/java/com/yas/product/exception/InternalServerErrorException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/InternalServerErrorException.java similarity index 78% rename from product/src/main/java/com/yas/product/exception/InternalServerErrorException.java rename to common-library/src/main/java/com/yas/commonlibrary/exception/InternalServerErrorException.java index 92ba05c78f..e68d1a6b92 100644 --- a/product/src/main/java/com/yas/product/exception/InternalServerErrorException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/InternalServerErrorException.java @@ -1,6 +1,6 @@ -package com.yas.product.exception; +package com.yas.commonlibrary.exception; -import com.yas.product.utils.MessagesUtils; +import com.yas.commonlibrary.utils.MessagesUtils; public class InternalServerErrorException extends RuntimeException { diff --git a/inventory/src/main/java/com/yas/inventory/exception/NotFoundException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/NotFoundException.java similarity index 81% rename from inventory/src/main/java/com/yas/inventory/exception/NotFoundException.java rename to common-library/src/main/java/com/yas/commonlibrary/exception/NotFoundException.java index bb48c03dd5..77e1a0798a 100644 --- a/inventory/src/main/java/com/yas/inventory/exception/NotFoundException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/NotFoundException.java @@ -1,9 +1,8 @@ -package com.yas.inventory.exception; +package com.yas.commonlibrary.exception; -import com.yas.inventory.utils.MessagesUtils; +import com.yas.commonlibrary.utils.MessagesUtils; public class NotFoundException extends RuntimeException { - private String message; public NotFoundException(String errorCode, Object... var2) { @@ -19,4 +18,3 @@ public void setMessage(String message) { this.message = message; } } - diff --git a/inventory/src/main/java/com/yas/inventory/exception/StockExistingException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/StockExistingException.java similarity index 81% rename from inventory/src/main/java/com/yas/inventory/exception/StockExistingException.java rename to common-library/src/main/java/com/yas/commonlibrary/exception/StockExistingException.java index 3c7199f577..800442a97f 100644 --- a/inventory/src/main/java/com/yas/inventory/exception/StockExistingException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/StockExistingException.java @@ -1,6 +1,6 @@ -package com.yas.inventory.exception; +package com.yas.commonlibrary.exception; -import com.yas.inventory.utils.MessagesUtils; +import com.yas.commonlibrary.utils.MessagesUtils; public class StockExistingException extends RuntimeException { private String message; diff --git a/customer/src/main/java/com/yas/customer/exception/WrongEmailFormatException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/WrongEmailFormatException.java similarity index 81% rename from customer/src/main/java/com/yas/customer/exception/WrongEmailFormatException.java rename to common-library/src/main/java/com/yas/commonlibrary/exception/WrongEmailFormatException.java index b5df79a4eb..60ef3c02dd 100644 --- a/customer/src/main/java/com/yas/customer/exception/WrongEmailFormatException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/WrongEmailFormatException.java @@ -1,6 +1,6 @@ -package com.yas.customer.exception; +package com.yas.commonlibrary.exception; -import com.yas.customer.utils.MessagesUtils; +import com.yas.commonlibrary.utils.MessagesUtils; public class WrongEmailFormatException extends RuntimeException { diff --git a/common-library/src/main/java/com/yas/commonlibrary/utils/AuthenticationUtils.java b/common-library/src/main/java/com/yas/commonlibrary/utils/AuthenticationUtils.java new file mode 100644 index 0000000000..b4fea3e186 --- /dev/null +++ b/common-library/src/main/java/com/yas/commonlibrary/utils/AuthenticationUtils.java @@ -0,0 +1,31 @@ +package com.yas.commonlibrary.utils; + +import com.yas.commonlibrary.constants.ApiConstant; +import com.yas.commonlibrary.exception.AccessDeniedException; +import org.springframework.security.authentication.AnonymousAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.jwt.Jwt; +import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken; + +public class AuthenticationUtils { + + private AuthenticationUtils() { + } + + public static String extractUserId() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + + if (authentication instanceof AnonymousAuthenticationToken) { + throw new AccessDeniedException(ApiConstant.ACCESS_DENIED); + } + + JwtAuthenticationToken contextHolder = (JwtAuthenticationToken) authentication; + + return contextHolder.getToken().getSubject(); + } + + public static String extractJwt() { + return ((Jwt) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getTokenValue(); + } +} \ No newline at end of file diff --git a/inventory/src/main/java/com/yas/inventory/utils/MessagesUtils.java b/common-library/src/main/java/com/yas/commonlibrary/utils/MessagesUtils.java similarity index 78% rename from inventory/src/main/java/com/yas/inventory/utils/MessagesUtils.java rename to common-library/src/main/java/com/yas/commonlibrary/utils/MessagesUtils.java index 5f055be616..a5909a6486 100644 --- a/inventory/src/main/java/com/yas/inventory/utils/MessagesUtils.java +++ b/common-library/src/main/java/com/yas/commonlibrary/utils/MessagesUtils.java @@ -1,4 +1,4 @@ -package com.yas.inventory.utils; +package com.yas.commonlibrary.utils; import java.util.Locale; import java.util.MissingResourceException; @@ -7,10 +7,13 @@ import org.slf4j.helpers.MessageFormatter; public class MessagesUtils { - - static ResourceBundle messageBundle = ResourceBundle.getBundle("messages.messages", + public static ResourceBundle messageBundle = ResourceBundle.getBundle("messages.messages", Locale.getDefault()); + private MessagesUtils() { + //Add constructor + } + public static String getMessage(String errorCode, Object... var2) { String message; try { diff --git a/common-library/src/main/java/com/yas/commonlibrary/viewmodel/error/ErrorVm.java b/common-library/src/main/java/com/yas/commonlibrary/viewmodel/error/ErrorVm.java new file mode 100644 index 0000000000..2ef990e47a --- /dev/null +++ b/common-library/src/main/java/com/yas/commonlibrary/viewmodel/error/ErrorVm.java @@ -0,0 +1,11 @@ +package com.yas.commonlibrary.viewmodel.error; + +import java.util.ArrayList; +import java.util.List; + +public record ErrorVm(String statusCode, String title, String detail, List fieldErrors) { + + public ErrorVm(String statusCode, String title, String detail) { + this(statusCode, title, detail, new ArrayList<>()); + } +} diff --git a/common-library/src/main/resources/application.properties b/common-library/src/main/resources/application.properties new file mode 100644 index 0000000000..fd4141ebf4 --- /dev/null +++ b/common-library/src/main/resources/application.properties @@ -0,0 +1,6 @@ +server.servlet.context-path=/common-library +spring.application.name=common-library +logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}] +spring.security.oauth2.resourceserver.jwt.issuer-uri=http://identity/realms/Yas +springdoc.oauthflow.authorization-url=http://identity/realms/Yas/protocol/openid-connect/auth +springdoc.oauthflow.token-url=http://identity/realms/Yas/protocol/openid-connect/token diff --git a/common-library/src/main/resources/logback-spring.xml b/common-library/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..1696eaf750 --- /dev/null +++ b/common-library/src/main/resources/logback-spring.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + ${user-system}.out + + ${CONSOLE_LOG_PATTERN} + ${ENCODING} + + + + + + + diff --git a/common-library/src/main/resources/messages/messages.properties b/common-library/src/main/resources/messages/messages.properties new file mode 100644 index 0000000000..015ad28ae3 --- /dev/null +++ b/common-library/src/main/resources/messages/messages.properties @@ -0,0 +1,43 @@ +NOT_FOUND_PRODUCT=Not found product {} +NOT_EXISTING_ITEM_IN_CART=There is no cart item in current cart to update! +NOT_EXISTING_PRODUCT_IN_CART=There is no product with ID: {} in the current cart +NON_EXISTING_CART_ITEM=Non exist cart item with ID: {} +USER_WITH_EMAIL_NOT_FOUND=User with email {} not found +WRONG_EMAIL_FORMAT=Wrong email format for {} +USER_NOT_FOUND=User not found +USER_ADDRESS_NOT_FOUND=User address not found +PRODUCT_NOT_FOUND=The product {} is not found +WAREHOUSE_NOT_FOUND=The warehouse {} is not found +INVALID_ADJUSTED_QUANTITY=Invalid adjusted quantity make a negative quantity +STATE_OR_PROVINCE_NOT_FOUND=The state or province {} is not found +ADDRESS_NOT_FOUND=The address {} is not found +COUNTRY_NOT_FOUND=The country {} is not found +CODE_ALREADY_EXISTED=The code {} is already existed +ORDER_NOT_FOUND=Order {} is not found +CHECKOUT_NOT_FOUND=Checkout {} is not found +SIGN_IN_REQUIRED=Authentication required +FORBIDDEN=You don't have permission to access this page +PAYMENT_PROVIDER_NOT_FOUND=Payment provider {} is not found +PAYMENT_FAIL_MESSAGE=Payment failed +PAYMENT_SUCCESS_MESSAGE=Payment successful +CATEGORY_NOT_FOUND=Category {} is not found +BRAND_NOT_FOUND=Brand {} is not found +PARENT_CATEGORY_NOT_FOUND=Parent category {} is not found +MAKE_SURE_CATEGORY_DO_NOT_CONTAIN_CHILDREN=Please make sure this category contains no children +MAKE_SURE_CATEGORY_DO_NOT_CONTAIN_PRODUCT=Please make sure this category contains no product +PARENT_CATEGORY_CANNOT_BE_ITSELF=Parent category cannot be itself children +THIS_PROD_ATTRI_NOT_EXIST_IN_ANY_PROD_ATTRI=Please make sure this Product Attribute doesn't exist in any Product Attribute Values +PRODUCT_ATTRIBUTE_VALUE_IS_NOT_FOUND=Product attribute value {} is not found +PRODUCT_ATTRIBUTE_IS_NOT_FOUND=Product Attribute {} is not found +PRODUCT_OPTION_IS_NOT_FOUND=Product option {} is not found +SLUG_IS_DUPLICATED=Slug {} is duplicated +MAKE_SURE_BRAND_DONT_CONTAINS_ANY_PRODUCT=Please make sure this brand don't contains any product +NAME_ALREADY_EXITED=Request name {} is already existed +SLUG_ALREADY_EXISTED_OR_DUPLICATED=Slug {} is already existed or is duplicated +SKU_ALREADY_EXISTED_OR_DUPLICATED=Sku {} is already existed or is duplicated +GTIN_ALREADY_EXISTED_OR_DUPLICATED=Gtin {} is already existed or is duplicated +RATING_NOT_FOUND=RATING {} is not found +CUSTOMER_NOT_FOUND=CUSTOMER {} is not found +RESOURCE_ALREADY_EXISTED=Resource already existed +ACCESS_DENIED=Access denied + diff --git a/common-library/src/test/resources/application.properties b/common-library/src/test/resources/application.properties new file mode 100644 index 0000000000..51fa61774d --- /dev/null +++ b/common-library/src/test/resources/application.properties @@ -0,0 +1,14 @@ +server.port=8080 +server.servlet.context-path=/product +# Setting Spring profile +spring.profiles.active=test +spring.datasource.url=jdbc:h2:mem:testdb;NON_KEYWORDS=VALUE +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password= +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.jpa.hibernate.ddl-auto=update +spring.liquibase.enabled=false +spring.security.oauth2.resourceserver.jwt.issuer-uri=test +springdoc.oauthflow.authorization-url=test +springdoc.oauthflow.token-url=test \ No newline at end of file diff --git a/customer/pom.xml b/customer/pom.xml index 4f9eea91bf..cbca8d4053 100644 --- a/customer/pom.xml +++ b/customer/pom.xml @@ -60,6 +60,11 @@ org.springframework.boot spring-boot-starter-validation + + com.yas + common-library + 1.0-SNAPSHOT + diff --git a/customer/src/it/java/com/yas/customer/service/UserAddressServiceIT.java b/customer/src/it/java/com/yas/customer/service/UserAddressServiceIT.java index bd49f410a6..7b3f2143f9 100644 --- a/customer/src/it/java/com/yas/customer/service/UserAddressServiceIT.java +++ b/customer/src/it/java/com/yas/customer/service/UserAddressServiceIT.java @@ -5,9 +5,9 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.customer.config.IntegrationTestConfiguration; -import com.yas.customer.exception.AccessDeniedException; -import com.yas.customer.exception.NotFoundException; +import com.yas.commonlibrary.exception.AccessDeniedException; import com.yas.customer.model.UserAddress; import com.yas.customer.repository.UserAddressRepository; import com.yas.customer.util.SecurityContextUtils; diff --git a/customer/src/main/java/com/yas/customer/exception/AccessDeniedException.java b/customer/src/main/java/com/yas/customer/exception/AccessDeniedException.java deleted file mode 100644 index 903c09391e..0000000000 --- a/customer/src/main/java/com/yas/customer/exception/AccessDeniedException.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.yas.customer.exception; - - -public class AccessDeniedException extends RuntimeException { - public AccessDeniedException(final String message) { - super(message); - } -} diff --git a/customer/src/main/java/com/yas/customer/exception/ApiExceptionHandler.java b/customer/src/main/java/com/yas/customer/exception/ApiExceptionHandler.java index 012b7dd95e..6236b14b0c 100644 --- a/customer/src/main/java/com/yas/customer/exception/ApiExceptionHandler.java +++ b/customer/src/main/java/com/yas/customer/exception/ApiExceptionHandler.java @@ -1,5 +1,9 @@ package com.yas.customer.exception; +import com.yas.commonlibrary.exception.AccessDeniedException; +import com.yas.commonlibrary.exception.CreateGuestUserException; +import com.yas.commonlibrary.exception.NotFoundException; +import com.yas.commonlibrary.exception.WrongEmailFormatException; import com.yas.customer.viewmodel.ErrorVm; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; diff --git a/customer/src/main/java/com/yas/customer/exception/CreateGuestUserException.java b/customer/src/main/java/com/yas/customer/exception/CreateGuestUserException.java deleted file mode 100644 index 161ac06417..0000000000 --- a/customer/src/main/java/com/yas/customer/exception/CreateGuestUserException.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.yas.customer.exception; - -public class CreateGuestUserException extends RuntimeException { - public CreateGuestUserException(final String message) { - super(message); - } -} diff --git a/customer/src/main/java/com/yas/customer/exception/NotFoundException.java b/customer/src/main/java/com/yas/customer/exception/NotFoundException.java deleted file mode 100644 index 7a89e8143d..0000000000 --- a/customer/src/main/java/com/yas/customer/exception/NotFoundException.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yas.customer.exception; - -import com.yas.customer.utils.MessagesUtils; - -public class NotFoundException extends RuntimeException { - private String message; - - public NotFoundException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/customer/src/main/java/com/yas/customer/service/CustomerService.java b/customer/src/main/java/com/yas/customer/service/CustomerService.java index 293c88c5b7..8be72ec55c 100644 --- a/customer/src/main/java/com/yas/customer/service/CustomerService.java +++ b/customer/src/main/java/com/yas/customer/service/CustomerService.java @@ -1,9 +1,9 @@ package com.yas.customer.service; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.customer.config.KeycloakPropsConfig; -import com.yas.customer.exception.AccessDeniedException; -import com.yas.customer.exception.NotFoundException; -import com.yas.customer.exception.WrongEmailFormatException; +import com.yas.commonlibrary.exception.AccessDeniedException; +import com.yas.commonlibrary.exception.WrongEmailFormatException; import com.yas.customer.utils.Constants; import com.yas.customer.viewmodel.customer.CustomerAdminVm; import com.yas.customer.viewmodel.customer.CustomerListVm; diff --git a/customer/src/main/java/com/yas/customer/service/UserAddressService.java b/customer/src/main/java/com/yas/customer/service/UserAddressService.java index e9b0f15cc9..0166a57c41 100644 --- a/customer/src/main/java/com/yas/customer/service/UserAddressService.java +++ b/customer/src/main/java/com/yas/customer/service/UserAddressService.java @@ -1,7 +1,7 @@ package com.yas.customer.service; -import com.yas.customer.exception.AccessDeniedException; -import com.yas.customer.exception.NotFoundException; +import com.yas.commonlibrary.exception.AccessDeniedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.customer.model.UserAddress; import com.yas.customer.repository.UserAddressRepository; import com.yas.customer.utils.Constants; diff --git a/customer/src/test/java/com/yas/customer/service/CustomerServiceTest.java b/customer/src/test/java/com/yas/customer/service/CustomerServiceTest.java index ac24e42eb4..8641e6222f 100644 --- a/customer/src/test/java/com/yas/customer/service/CustomerServiceTest.java +++ b/customer/src/test/java/com/yas/customer/service/CustomerServiceTest.java @@ -10,10 +10,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.customer.config.KeycloakPropsConfig; -import com.yas.customer.exception.AccessDeniedException; -import com.yas.customer.exception.NotFoundException; -import com.yas.customer.exception.WrongEmailFormatException; +import com.yas.commonlibrary.exception.AccessDeniedException; +import com.yas.commonlibrary.exception.WrongEmailFormatException; import com.yas.customer.viewmodel.customer.CustomerAdminVm; import com.yas.customer.viewmodel.customer.CustomerListVm; import com.yas.customer.viewmodel.customer.CustomerProfileRequestVm; diff --git a/inventory/pom.xml b/inventory/pom.xml index 080210cebe..433b629e40 100644 --- a/inventory/pom.xml +++ b/inventory/pom.xml @@ -52,6 +52,11 @@ org.liquibase liquibase-core + + com.yas + common-library + 1.0-SNAPSHOT + diff --git a/inventory/src/it/java/com/yas/inventory/service/StockServiceIT.java b/inventory/src/it/java/com/yas/inventory/service/StockServiceIT.java index 9a308c4e4d..af5bd73425 100644 --- a/inventory/src/it/java/com/yas/inventory/service/StockServiceIT.java +++ b/inventory/src/it/java/com/yas/inventory/service/StockServiceIT.java @@ -13,9 +13,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.yas.inventory.exception.BadRequestException; -import com.yas.inventory.exception.NotFoundException; -import com.yas.inventory.exception.StockExistingException; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; +import com.yas.commonlibrary.exception.StockExistingException; import com.yas.inventory.model.Stock; import com.yas.inventory.model.Warehouse; import com.yas.inventory.repository.StockRepository; diff --git a/inventory/src/it/java/com/yas/inventory/service/WarehouseServiceIT.java b/inventory/src/it/java/com/yas/inventory/service/WarehouseServiceIT.java index 0b52f3550f..c759706aa7 100644 --- a/inventory/src/it/java/com/yas/inventory/service/WarehouseServiceIT.java +++ b/inventory/src/it/java/com/yas/inventory/service/WarehouseServiceIT.java @@ -16,8 +16,8 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import com.yas.inventory.exception.DuplicatedException; -import com.yas.inventory.exception.NotFoundException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.inventory.model.Warehouse; import com.yas.inventory.model.enumeration.FilterExistInWhSelection; import com.yas.inventory.repository.StockRepository; diff --git a/inventory/src/main/java/com/yas/inventory/exception/ApiExceptionHandler.java b/inventory/src/main/java/com/yas/inventory/exception/ApiExceptionHandler.java index 6f5262d4ff..b5a817ae9a 100644 --- a/inventory/src/main/java/com/yas/inventory/exception/ApiExceptionHandler.java +++ b/inventory/src/main/java/com/yas/inventory/exception/ApiExceptionHandler.java @@ -1,5 +1,6 @@ package com.yas.inventory.exception; +import com.yas.commonlibrary.exception.*; import com.yas.inventory.viewmodel.error.ErrorVm; import jakarta.validation.ConstraintViolation; import jakarta.validation.ConstraintViolationException; diff --git a/inventory/src/main/java/com/yas/inventory/exception/BadRequestException.java b/inventory/src/main/java/com/yas/inventory/exception/BadRequestException.java deleted file mode 100644 index 75448bc704..0000000000 --- a/inventory/src/main/java/com/yas/inventory/exception/BadRequestException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yas.inventory.exception; - -import com.yas.inventory.utils.MessagesUtils; - -public class BadRequestException extends RuntimeException { - - private String message; - - public BadRequestException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/inventory/src/main/java/com/yas/inventory/exception/DuplicatedException.java b/inventory/src/main/java/com/yas/inventory/exception/DuplicatedException.java deleted file mode 100644 index 903fd02042..0000000000 --- a/inventory/src/main/java/com/yas/inventory/exception/DuplicatedException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yas.inventory.exception; - -import com.yas.inventory.utils.MessagesUtils; - -public class DuplicatedException extends RuntimeException { - - private String message; - - public DuplicatedException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/inventory/src/main/java/com/yas/inventory/service/StockService.java b/inventory/src/main/java/com/yas/inventory/service/StockService.java index b94ba88772..d637a6b924 100644 --- a/inventory/src/main/java/com/yas/inventory/service/StockService.java +++ b/inventory/src/main/java/com/yas/inventory/service/StockService.java @@ -1,10 +1,10 @@ package com.yas.inventory.service; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; +import com.yas.commonlibrary.exception.StockExistingException; import com.yas.inventory.constants.ApiConstant; import com.yas.inventory.constants.MessageCode; -import com.yas.inventory.exception.BadRequestException; -import com.yas.inventory.exception.NotFoundException; -import com.yas.inventory.exception.StockExistingException; import com.yas.inventory.model.Stock; import com.yas.inventory.model.Warehouse; import com.yas.inventory.model.enumeration.FilterExistInWhSelection; diff --git a/inventory/src/main/java/com/yas/inventory/service/WarehouseService.java b/inventory/src/main/java/com/yas/inventory/service/WarehouseService.java index 84c97ad8f6..8efdd3b147 100644 --- a/inventory/src/main/java/com/yas/inventory/service/WarehouseService.java +++ b/inventory/src/main/java/com/yas/inventory/service/WarehouseService.java @@ -1,8 +1,8 @@ package com.yas.inventory.service; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.inventory.constants.MessageCode; -import com.yas.inventory.exception.DuplicatedException; -import com.yas.inventory.exception.NotFoundException; import com.yas.inventory.model.Warehouse; import com.yas.inventory.model.enumeration.FilterExistInWhSelection; import com.yas.inventory.repository.StockRepository; diff --git a/inventory/src/main/java/com/yas/inventory/utils/AuthenticationUtils.java b/inventory/src/main/java/com/yas/inventory/utils/AuthenticationUtils.java index 6b1f159516..9b12419f53 100644 --- a/inventory/src/main/java/com/yas/inventory/utils/AuthenticationUtils.java +++ b/inventory/src/main/java/com/yas/inventory/utils/AuthenticationUtils.java @@ -1,7 +1,7 @@ package com.yas.inventory.utils; +import com.yas.commonlibrary.exception.AccessDeniedException; import com.yas.inventory.constants.ApiConstant; -import com.yas.inventory.exception.AccessDeniedException; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/location/pom.xml b/location/pom.xml index 198e4b2173..78f57068a9 100644 --- a/location/pom.xml +++ b/location/pom.xml @@ -52,6 +52,11 @@ org.liquibase liquibase-core + + com.yas + common-library + 1.0-SNAPSHOT + diff --git a/location/src/main/java/com/yas/location/exception/ApiExceptionHandler.java b/location/src/main/java/com/yas/location/exception/ApiExceptionHandler.java index 883e23ff1f..6a00d5ceb8 100644 --- a/location/src/main/java/com/yas/location/exception/ApiExceptionHandler.java +++ b/location/src/main/java/com/yas/location/exception/ApiExceptionHandler.java @@ -1,5 +1,8 @@ package com.yas.location.exception; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.location.viewmodel.error.ErrorVm; import jakarta.validation.ConstraintViolationException; import java.util.List; diff --git a/location/src/main/java/com/yas/location/exception/BadRequestException.java b/location/src/main/java/com/yas/location/exception/BadRequestException.java deleted file mode 100644 index 3548cf4222..0000000000 --- a/location/src/main/java/com/yas/location/exception/BadRequestException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yas.location.exception; - -import com.yas.location.utils.MessagesUtils; - -public class BadRequestException extends RuntimeException { - - private String message; - - public BadRequestException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/location/src/main/java/com/yas/location/exception/NotFoundException.java b/location/src/main/java/com/yas/location/exception/NotFoundException.java deleted file mode 100644 index e485358d83..0000000000 --- a/location/src/main/java/com/yas/location/exception/NotFoundException.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.yas.location.exception; - -import com.yas.location.utils.MessagesUtils; - -public class NotFoundException extends RuntimeException { - - private String message; - - public NotFoundException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} - diff --git a/location/src/main/java/com/yas/location/service/AddressService.java b/location/src/main/java/com/yas/location/service/AddressService.java index 30fb281e34..de2be8f60b 100644 --- a/location/src/main/java/com/yas/location/service/AddressService.java +++ b/location/src/main/java/com/yas/location/service/AddressService.java @@ -1,6 +1,6 @@ package com.yas.location.service; -import com.yas.location.exception.NotFoundException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.location.model.Address; import com.yas.location.model.Country; import com.yas.location.repository.AddressRepository; diff --git a/location/src/main/java/com/yas/location/service/CountryService.java b/location/src/main/java/com/yas/location/service/CountryService.java index 5b760b73eb..823a90398b 100644 --- a/location/src/main/java/com/yas/location/service/CountryService.java +++ b/location/src/main/java/com/yas/location/service/CountryService.java @@ -1,7 +1,7 @@ package com.yas.location.service; -import com.yas.location.exception.DuplicatedException; -import com.yas.location.exception.NotFoundException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.location.mapper.CountryMapper; import com.yas.location.model.Country; import com.yas.location.repository.CountryRepository; diff --git a/location/src/main/java/com/yas/location/service/StateOrProvinceService.java b/location/src/main/java/com/yas/location/service/StateOrProvinceService.java index d4c6a2069b..680154c4e7 100644 --- a/location/src/main/java/com/yas/location/service/StateOrProvinceService.java +++ b/location/src/main/java/com/yas/location/service/StateOrProvinceService.java @@ -1,7 +1,7 @@ package com.yas.location.service; -import com.yas.location.exception.DuplicatedException; -import com.yas.location.exception.NotFoundException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.location.mapper.StateOrProvinceMapper; import com.yas.location.model.StateOrProvince; import com.yas.location.repository.CountryRepository; diff --git a/location/src/test/java/com/yas/location/service/AddressServiceTest.java b/location/src/test/java/com/yas/location/service/AddressServiceTest.java index 8bf5b1d0dd..5fa0e55f59 100644 --- a/location/src/test/java/com/yas/location/service/AddressServiceTest.java +++ b/location/src/test/java/com/yas/location/service/AddressServiceTest.java @@ -4,8 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.location.LocationApplication; -import com.yas.location.exception.NotFoundException; import com.yas.location.model.Address; import com.yas.location.model.Country; import com.yas.location.model.District; diff --git a/location/src/test/java/com/yas/location/service/CountryServiceTest.java b/location/src/test/java/com/yas/location/service/CountryServiceTest.java index 133630113c..dbbbe73b1d 100644 --- a/location/src/test/java/com/yas/location/service/CountryServiceTest.java +++ b/location/src/test/java/com/yas/location/service/CountryServiceTest.java @@ -5,9 +5,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.location.LocationApplication; -import com.yas.location.exception.DuplicatedException; -import com.yas.location.exception.NotFoundException; import com.yas.location.model.Country; import com.yas.location.repository.CountryRepository; diff --git a/location/src/test/java/com/yas/location/service/StateOrProvinceServiceTest.java b/location/src/test/java/com/yas/location/service/StateOrProvinceServiceTest.java index 0e002e251b..7b6a5a04af 100644 --- a/location/src/test/java/com/yas/location/service/StateOrProvinceServiceTest.java +++ b/location/src/test/java/com/yas/location/service/StateOrProvinceServiceTest.java @@ -4,9 +4,9 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.location.LocationApplication; -import com.yas.location.exception.DuplicatedException; -import com.yas.location.exception.NotFoundException; import com.yas.location.model.Country; import com.yas.location.model.StateOrProvince; import com.yas.location.repository.CountryRepository; diff --git a/pom.xml b/pom.xml index 964e5a1d2d..221bb48049 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,7 @@ yas + common-library backoffice-bff cart customer diff --git a/product/pom.xml b/product/pom.xml index 5827587c5a..fca7f882c4 100644 --- a/product/pom.xml +++ b/product/pom.xml @@ -62,6 +62,11 @@ org.liquibase liquibase-core + + com.yas + common-library + 1.0-SNAPSHOT + diff --git a/product/src/main/java/com/yas/product/controller/BrandController.java b/product/src/main/java/com/yas/product/controller/BrandController.java index e4f3b3ff0e..0142295947 100644 --- a/product/src/main/java/com/yas/product/controller/BrandController.java +++ b/product/src/main/java/com/yas/product/controller/BrandController.java @@ -1,7 +1,8 @@ package com.yas.product.controller; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.constants.PageableConstant; -import com.yas.product.exception.NotFoundException; import com.yas.product.model.Brand; import com.yas.product.repository.BrandRepository; import com.yas.product.service.BrandService; diff --git a/product/src/main/java/com/yas/product/controller/CategoryController.java b/product/src/main/java/com/yas/product/controller/CategoryController.java index 52315511ae..b3aaead33d 100644 --- a/product/src/main/java/com/yas/product/controller/CategoryController.java +++ b/product/src/main/java/com/yas/product/controller/CategoryController.java @@ -1,6 +1,6 @@ package com.yas.product.controller; -import com.yas.product.exception.BadRequestException; +import com.yas.commonlibrary.exception.BadRequestException; import com.yas.product.model.Category; import com.yas.product.repository.CategoryRepository; import com.yas.product.service.CategoryService; diff --git a/product/src/main/java/com/yas/product/controller/ProductAttributeController.java b/product/src/main/java/com/yas/product/controller/ProductAttributeController.java index 741f54631a..3cc12fb304 100644 --- a/product/src/main/java/com/yas/product/controller/ProductAttributeController.java +++ b/product/src/main/java/com/yas/product/controller/ProductAttributeController.java @@ -1,8 +1,8 @@ package com.yas.product.controller; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.constants.PageableConstant; -import com.yas.product.exception.BadRequestException; -import com.yas.product.exception.NotFoundException; import com.yas.product.model.attribute.ProductAttribute; import com.yas.product.repository.ProductAttributeRepository; import com.yas.product.service.ProductAttributeService; diff --git a/product/src/main/java/com/yas/product/controller/ProductAttributeGroupController.java b/product/src/main/java/com/yas/product/controller/ProductAttributeGroupController.java index 688643b6f9..57df325b09 100644 --- a/product/src/main/java/com/yas/product/controller/ProductAttributeGroupController.java +++ b/product/src/main/java/com/yas/product/controller/ProductAttributeGroupController.java @@ -1,7 +1,7 @@ package com.yas.product.controller; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.constants.PageableConstant; -import com.yas.product.exception.NotFoundException; import com.yas.product.model.attribute.ProductAttributeGroup; import com.yas.product.repository.ProductAttributeGroupRepository; import com.yas.product.service.ProductAttributeGroupService; diff --git a/product/src/main/java/com/yas/product/controller/ProductAttributeValueController.java b/product/src/main/java/com/yas/product/controller/ProductAttributeValueController.java index 0a92243454..462927a352 100644 --- a/product/src/main/java/com/yas/product/controller/ProductAttributeValueController.java +++ b/product/src/main/java/com/yas/product/controller/ProductAttributeValueController.java @@ -1,7 +1,7 @@ package com.yas.product.controller; -import com.yas.product.exception.BadRequestException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.Product; import com.yas.product.model.attribute.ProductAttribute; import com.yas.product.model.attribute.ProductAttributeValue; diff --git a/product/src/main/java/com/yas/product/controller/ProductOptionController.java b/product/src/main/java/com/yas/product/controller/ProductOptionController.java index f23d3f07e6..3c59138e77 100644 --- a/product/src/main/java/com/yas/product/controller/ProductOptionController.java +++ b/product/src/main/java/com/yas/product/controller/ProductOptionController.java @@ -1,7 +1,7 @@ package com.yas.product.controller; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.constants.PageableConstant; -import com.yas.product.exception.NotFoundException; import com.yas.product.model.ProductOption; import com.yas.product.repository.ProductOptionRepository; import com.yas.product.service.ProductOptionService; diff --git a/product/src/main/java/com/yas/product/controller/ProductOptionValueController.java b/product/src/main/java/com/yas/product/controller/ProductOptionValueController.java index 08418d9566..27215a25ea 100644 --- a/product/src/main/java/com/yas/product/controller/ProductOptionValueController.java +++ b/product/src/main/java/com/yas/product/controller/ProductOptionValueController.java @@ -1,6 +1,6 @@ package com.yas.product.controller; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.Product; import com.yas.product.repository.ProductOptionValueRepository; import com.yas.product.repository.ProductRepository; diff --git a/product/src/main/java/com/yas/product/exception/ApiExceptionHandler.java b/product/src/main/java/com/yas/product/exception/ApiExceptionHandler.java index 468f213ba9..8c10d67409 100644 --- a/product/src/main/java/com/yas/product/exception/ApiExceptionHandler.java +++ b/product/src/main/java/com/yas/product/exception/ApiExceptionHandler.java @@ -1,5 +1,9 @@ package com.yas.product.exception; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.InternalServerErrorException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.viewmodel.error.ErrorVm; import jakarta.validation.ConstraintViolationException; import java.util.List; diff --git a/product/src/main/java/com/yas/product/exception/DuplicatedException.java b/product/src/main/java/com/yas/product/exception/DuplicatedException.java deleted file mode 100644 index a4fd6ce757..0000000000 --- a/product/src/main/java/com/yas/product/exception/DuplicatedException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yas.product.exception; - -import com.yas.product.utils.MessagesUtils; - -public class DuplicatedException extends RuntimeException { - - private String message; - - public DuplicatedException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/product/src/main/java/com/yas/product/exception/NotFoundException.java b/product/src/main/java/com/yas/product/exception/NotFoundException.java deleted file mode 100644 index 678e0abd9f..0000000000 --- a/product/src/main/java/com/yas/product/exception/NotFoundException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yas.product.exception; - -import com.yas.product.utils.MessagesUtils; - -public class NotFoundException extends RuntimeException { - - private String message; - - public NotFoundException(String errorCode, Object... var2) { - this.message = MessagesUtils.getMessage(errorCode, var2); - } - - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/product/src/main/java/com/yas/product/service/BrandService.java b/product/src/main/java/com/yas/product/service/BrandService.java index 46cd304e9b..418b84319d 100644 --- a/product/src/main/java/com/yas/product/service/BrandService.java +++ b/product/src/main/java/com/yas/product/service/BrandService.java @@ -1,8 +1,8 @@ package com.yas.product.service; -import com.yas.product.exception.BadRequestException; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; +import com.yas.commonlibrary.exception.BadRequestException; import com.yas.product.model.Brand; import com.yas.product.repository.BrandRepository; import com.yas.product.utils.Constants; diff --git a/product/src/main/java/com/yas/product/service/CategoryService.java b/product/src/main/java/com/yas/product/service/CategoryService.java index 3f579a7efe..676410cc8b 100644 --- a/product/src/main/java/com/yas/product/service/CategoryService.java +++ b/product/src/main/java/com/yas/product/service/CategoryService.java @@ -1,8 +1,8 @@ package com.yas.product.service; -import com.yas.product.exception.BadRequestException; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.Category; import com.yas.product.repository.CategoryRepository; import com.yas.product.utils.Constants; diff --git a/product/src/main/java/com/yas/product/service/ProductAttributeGroupService.java b/product/src/main/java/com/yas/product/service/ProductAttributeGroupService.java index 2a21ba8f73..d8e38ace3a 100644 --- a/product/src/main/java/com/yas/product/service/ProductAttributeGroupService.java +++ b/product/src/main/java/com/yas/product/service/ProductAttributeGroupService.java @@ -1,6 +1,6 @@ package com.yas.product.service; -import com.yas.product.exception.DuplicatedException; +import com.yas.commonlibrary.exception.DuplicatedException; import com.yas.product.model.attribute.ProductAttributeGroup; import com.yas.product.repository.ProductAttributeGroupRepository; import com.yas.product.utils.Constants; diff --git a/product/src/main/java/com/yas/product/service/ProductAttributeService.java b/product/src/main/java/com/yas/product/service/ProductAttributeService.java index f972920169..9b1f03a9f1 100644 --- a/product/src/main/java/com/yas/product/service/ProductAttributeService.java +++ b/product/src/main/java/com/yas/product/service/ProductAttributeService.java @@ -1,8 +1,8 @@ package com.yas.product.service; -import com.yas.product.exception.BadRequestException; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.attribute.ProductAttribute; import com.yas.product.model.attribute.ProductAttributeGroup; import com.yas.product.repository.ProductAttributeGroupRepository; diff --git a/product/src/main/java/com/yas/product/service/ProductOptionService.java b/product/src/main/java/com/yas/product/service/ProductOptionService.java index fb0b938814..7a7d9ff7e6 100644 --- a/product/src/main/java/com/yas/product/service/ProductOptionService.java +++ b/product/src/main/java/com/yas/product/service/ProductOptionService.java @@ -1,7 +1,7 @@ package com.yas.product.service; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.ProductOption; import com.yas.product.repository.ProductOptionRepository; import com.yas.product.utils.Constants; diff --git a/product/src/main/java/com/yas/product/service/ProductService.java b/product/src/main/java/com/yas/product/service/ProductService.java index 4263ef0842..3616b792c4 100644 --- a/product/src/main/java/com/yas/product/service/ProductService.java +++ b/product/src/main/java/com/yas/product/service/ProductService.java @@ -1,9 +1,9 @@ package com.yas.product.service; -import com.yas.product.exception.BadRequestException; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.InternalServerErrorException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.InternalServerErrorException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.Brand; import com.yas.product.model.Category; import com.yas.product.model.Product; diff --git a/product/src/main/java/com/yas/product/service/ProductTemplateService.java b/product/src/main/java/com/yas/product/service/ProductTemplateService.java index 1b45d2daea..757ea1ce49 100644 --- a/product/src/main/java/com/yas/product/service/ProductTemplateService.java +++ b/product/src/main/java/com/yas/product/service/ProductTemplateService.java @@ -1,8 +1,8 @@ package com.yas.product.service; -import com.yas.product.exception.BadRequestException; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.attribute.ProductAttribute; import com.yas.product.model.attribute.ProductAttributeTemplate; import com.yas.product.model.attribute.ProductTemplate; diff --git a/product/src/test/java/com/yas/product/controller/ProductTemplateControllerTest.java b/product/src/test/java/com/yas/product/controller/ProductTemplateControllerTest.java index 74a7663a9c..45a510ab65 100644 --- a/product/src/test/java/com/yas/product/controller/ProductTemplateControllerTest.java +++ b/product/src/test/java/com/yas/product/controller/ProductTemplateControllerTest.java @@ -1,8 +1,8 @@ package com.yas.product.controller; import com.fasterxml.jackson.databind.ObjectMapper; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.ProductApplication; -import com.yas.product.exception.NotFoundException; import com.yas.product.model.attribute.ProductTemplate; import com.yas.product.repository.ProductTemplateRepository; import com.yas.product.service.ProductTemplateService; diff --git a/product/src/test/java/com/yas/product/service/BrandServiceTest.java b/product/src/test/java/com/yas/product/service/BrandServiceTest.java index 0ae443beea..3f33a26fb0 100644 --- a/product/src/test/java/com/yas/product/service/BrandServiceTest.java +++ b/product/src/test/java/com/yas/product/service/BrandServiceTest.java @@ -1,7 +1,7 @@ package com.yas.product.service; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.Brand; import com.yas.product.repository.BrandRepository; import com.yas.product.viewmodel.brand.BrandListGetVm; diff --git a/product/src/test/java/com/yas/product/service/ProductAttributeGroupServiceTest.java b/product/src/test/java/com/yas/product/service/ProductAttributeGroupServiceTest.java index 67d4dc1835..2004841aad 100644 --- a/product/src/test/java/com/yas/product/service/ProductAttributeGroupServiceTest.java +++ b/product/src/test/java/com/yas/product/service/ProductAttributeGroupServiceTest.java @@ -1,6 +1,6 @@ package com.yas.product.service; -import com.yas.product.exception.DuplicatedException; +import com.yas.commonlibrary.exception.DuplicatedException; import com.yas.product.model.attribute.ProductAttributeGroup; import com.yas.product.repository.ProductAttributeGroupRepository; import com.yas.product.viewmodel.productattribute.ProductAttributeGroupListGetVm; diff --git a/product/src/test/java/com/yas/product/service/ProductAttributeServiceTest.java b/product/src/test/java/com/yas/product/service/ProductAttributeServiceTest.java index c089a13183..a222df4679 100644 --- a/product/src/test/java/com/yas/product/service/ProductAttributeServiceTest.java +++ b/product/src/test/java/com/yas/product/service/ProductAttributeServiceTest.java @@ -1,6 +1,6 @@ package com.yas.product.service; -import com.yas.product.exception.DuplicatedException; +import com.yas.commonlibrary.exception.DuplicatedException; import com.yas.product.model.attribute.ProductAttribute; import com.yas.product.model.attribute.ProductAttributeGroup; import com.yas.product.repository.ProductAttributeGroupRepository; diff --git a/product/src/test/java/com/yas/product/service/ProductOptionServiceTest.java b/product/src/test/java/com/yas/product/service/ProductOptionServiceTest.java index 231f33b792..bb32c50e48 100644 --- a/product/src/test/java/com/yas/product/service/ProductOptionServiceTest.java +++ b/product/src/test/java/com/yas/product/service/ProductOptionServiceTest.java @@ -1,7 +1,7 @@ package com.yas.product.service; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.NotFoundException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.model.ProductOption; import com.yas.product.repository.ProductOptionRepository; import com.yas.product.viewmodel.productoption.ProductOptionListGetVm; diff --git a/product/src/test/java/com/yas/product/service/ProductServiceTest.java b/product/src/test/java/com/yas/product/service/ProductServiceTest.java index d109f68d45..71ace023a1 100644 --- a/product/src/test/java/com/yas/product/service/ProductServiceTest.java +++ b/product/src/test/java/com/yas/product/service/ProductServiceTest.java @@ -1,7 +1,7 @@ package com.yas.product.service; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.ProductApplication; -import com.yas.product.exception.NotFoundException; import com.yas.product.model.Brand; import com.yas.product.model.Category; import com.yas.product.model.Product; diff --git a/product/src/test/java/com/yas/product/service/ProductTemplateServiceTest.java b/product/src/test/java/com/yas/product/service/ProductTemplateServiceTest.java index f4d833a144..5612bcf683 100644 --- a/product/src/test/java/com/yas/product/service/ProductTemplateServiceTest.java +++ b/product/src/test/java/com/yas/product/service/ProductTemplateServiceTest.java @@ -1,9 +1,9 @@ package com.yas.product.service; +import com.yas.commonlibrary.exception.BadRequestException; +import com.yas.commonlibrary.exception.DuplicatedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.product.ProductApplication; -import com.yas.product.exception.BadRequestException; -import com.yas.product.exception.DuplicatedException; -import com.yas.product.exception.NotFoundException; import com.yas.product.model.attribute.ProductAttribute; import com.yas.product.model.attribute.ProductAttributeTemplate; import com.yas.product.model.attribute.ProductTemplate; From 491a1a191ccd3ffc9761c4aef90ead6bfc7d8b7f Mon Sep 17 00:00:00 2001 From: nashtech-huyphamphu Date: Tue, 17 Sep 2024 11:16:49 +0700 Subject: [PATCH 2/7] #882 Create a shared project --- cart/src/main/java/com/yas/cart/config/SwaggerConfig.java | 2 +- .../java/com/yas/commonlibrary/constants/MessageCode.java | 1 + .../com/yas/commonlibrary/constants/PageableConstant.java | 1 + .../main/java/com/yas/customer/service/CustomerService.java | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cart/src/main/java/com/yas/cart/config/SwaggerConfig.java b/cart/src/main/java/com/yas/cart/config/SwaggerConfig.java index 6ee7cf309e..bc99e48080 100644 --- a/cart/src/main/java/com/yas/cart/config/SwaggerConfig.java +++ b/cart/src/main/java/com/yas/cart/config/SwaggerConfig.java @@ -17,6 +17,6 @@ flows = @OAuthFlows(authorizationCode = @OAuthFlow( authorizationUrl = "${springdoc.oauthflow.authorization-url}", tokenUrl = "${springdoc.oauthflow.token-url}", scopes = { - @OAuthScope(name = "openid", description = "openid")}))) + @OAuthScope(name = "openid", description = "openid")}))) public class SwaggerConfig { } diff --git a/common-library/src/main/java/com/yas/commonlibrary/constants/MessageCode.java b/common-library/src/main/java/com/yas/commonlibrary/constants/MessageCode.java index 8c47df9cc1..7b126e0ed1 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/constants/MessageCode.java +++ b/common-library/src/main/java/com/yas/commonlibrary/constants/MessageCode.java @@ -4,6 +4,7 @@ public final class MessageCode { public static final String WAREHOUSE_NOT_FOUND = "WAREHOUSE_NOT_FOUND"; public static final String PRODUCT_NOT_FOUND = "PRODUCT_NOT_FOUND"; public static final String NAME_ALREADY_EXITED = "NAME_ALREADY_EXITED"; + private MessageCode() { //Add constructor } diff --git a/common-library/src/main/java/com/yas/commonlibrary/constants/PageableConstant.java b/common-library/src/main/java/com/yas/commonlibrary/constants/PageableConstant.java index eb20421900..24fb7afd50 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/constants/PageableConstant.java +++ b/common-library/src/main/java/com/yas/commonlibrary/constants/PageableConstant.java @@ -3,6 +3,7 @@ public final class PageableConstant { public static final String DEFAULT_PAGE_SIZE = "10"; public static final String DEFAULT_PAGE_NUMBER = "0"; + private PageableConstant() { //Add constructor } diff --git a/customer/src/main/java/com/yas/customer/service/CustomerService.java b/customer/src/main/java/com/yas/customer/service/CustomerService.java index 8be72ec55c..31acec2378 100644 --- a/customer/src/main/java/com/yas/customer/service/CustomerService.java +++ b/customer/src/main/java/com/yas/customer/service/CustomerService.java @@ -1,9 +1,9 @@ package com.yas.customer.service; -import com.yas.commonlibrary.exception.NotFoundException; -import com.yas.customer.config.KeycloakPropsConfig; import com.yas.commonlibrary.exception.AccessDeniedException; +import com.yas.commonlibrary.exception.NotFoundException; import com.yas.commonlibrary.exception.WrongEmailFormatException; +import com.yas.customer.config.KeycloakPropsConfig; import com.yas.customer.utils.Constants; import com.yas.customer.viewmodel.customer.CustomerAdminVm; import com.yas.customer.viewmodel.customer.CustomerListVm; From 2bcceaa69f6f4160763ea918e4dced2fc48faff3 Mon Sep 17 00:00:00 2001 From: nashtech-huyphamphu Date: Tue, 17 Sep 2024 13:53:09 +0700 Subject: [PATCH 3/7] #882 Create a shared project --- .../yas/commonlibrary/exception/BadRequestException.java | 5 +---- .../yas/commonlibrary/exception/DuplicatedException.java | 6 +----- .../com/yas/commonlibrary/exception/NotFoundException.java | 6 +----- .../yas/commonlibrary/exception/StockExistingException.java | 5 +---- .../commonlibrary/exception/WrongEmailFormatException.java | 6 +----- .../java/com/yas/commonlibrary/utils/MessagesUtils.java | 2 +- 6 files changed, 6 insertions(+), 24 deletions(-) diff --git a/common-library/src/main/java/com/yas/commonlibrary/exception/BadRequestException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/BadRequestException.java index ffe39ea683..6990a7b9b3 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/exception/BadRequestException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/BadRequestException.java @@ -4,7 +4,7 @@ public class BadRequestException extends RuntimeException { - private String message; + private final String message; public BadRequestException(String message) { this.message = MessagesUtils.getMessage(message); @@ -19,7 +19,4 @@ public String getMessage() { return message; } - public void setMessage(String message) { - this.message = message; - } } diff --git a/common-library/src/main/java/com/yas/commonlibrary/exception/DuplicatedException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/DuplicatedException.java index 80f0595784..ceb0b1823e 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/exception/DuplicatedException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/DuplicatedException.java @@ -4,7 +4,7 @@ public class DuplicatedException extends RuntimeException { - private String message; + private final String message; public DuplicatedException(String errorCode, Object... var2) { this.message = MessagesUtils.getMessage(errorCode, var2); @@ -14,8 +14,4 @@ public DuplicatedException(String errorCode, Object... var2) { public String getMessage() { return message; } - - public void setMessage(String message) { - this.message = message; - } } diff --git a/common-library/src/main/java/com/yas/commonlibrary/exception/NotFoundException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/NotFoundException.java index 77e1a0798a..baa47859d2 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/exception/NotFoundException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/NotFoundException.java @@ -3,7 +3,7 @@ import com.yas.commonlibrary.utils.MessagesUtils; public class NotFoundException extends RuntimeException { - private String message; + private final String message; public NotFoundException(String errorCode, Object... var2) { this.message = MessagesUtils.getMessage(errorCode, var2); @@ -13,8 +13,4 @@ public NotFoundException(String errorCode, Object... var2) { public String getMessage() { return message; } - - public void setMessage(String message) { - this.message = message; - } } diff --git a/common-library/src/main/java/com/yas/commonlibrary/exception/StockExistingException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/StockExistingException.java index 800442a97f..59faedd882 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/exception/StockExistingException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/StockExistingException.java @@ -3,7 +3,7 @@ import com.yas.commonlibrary.utils.MessagesUtils; public class StockExistingException extends RuntimeException { - private String message; + private final String message; public StockExistingException(String errorCode, Object... var2) { this.message = MessagesUtils.getMessage(errorCode, var2); @@ -14,7 +14,4 @@ public String getMessage() { return message; } - public void setMessage(String message) { - this.message = message; - } } diff --git a/common-library/src/main/java/com/yas/commonlibrary/exception/WrongEmailFormatException.java b/common-library/src/main/java/com/yas/commonlibrary/exception/WrongEmailFormatException.java index 60ef3c02dd..d0541e22c5 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/exception/WrongEmailFormatException.java +++ b/common-library/src/main/java/com/yas/commonlibrary/exception/WrongEmailFormatException.java @@ -4,7 +4,7 @@ public class WrongEmailFormatException extends RuntimeException { - private String message; + private final String message; public WrongEmailFormatException(String errorCode, Object... var2) { this.message = MessagesUtils.getMessage(errorCode, var2); @@ -14,8 +14,4 @@ public WrongEmailFormatException(String errorCode, Object... var2) { public String getMessage() { return message; } - - public void setMessage(String message) { - this.message = message; - } } diff --git a/common-library/src/main/java/com/yas/commonlibrary/utils/MessagesUtils.java b/common-library/src/main/java/com/yas/commonlibrary/utils/MessagesUtils.java index a5909a6486..b5599d8212 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/utils/MessagesUtils.java +++ b/common-library/src/main/java/com/yas/commonlibrary/utils/MessagesUtils.java @@ -7,7 +7,7 @@ import org.slf4j.helpers.MessageFormatter; public class MessagesUtils { - public static ResourceBundle messageBundle = ResourceBundle.getBundle("messages.messages", + private static final ResourceBundle messageBundle = ResourceBundle.getBundle("messages.messages", Locale.getDefault()); private MessagesUtils() { From 15ff5cb9a033b9faa833815617e018b47eec3334 Mon Sep 17 00:00:00 2001 From: nashtech-huyphamphu Date: Tue, 17 Sep 2024 16:43:39 +0700 Subject: [PATCH 4/7] #882 Create a shared project --- cart/pom.xml | 2 +- .../commonlibrary/CommonLibraryApplication.java | 15 --------------- customer/pom.xml | 2 +- inventory/pom.xml | 2 +- location/pom.xml | 2 +- product/pom.xml | 2 +- 6 files changed, 5 insertions(+), 20 deletions(-) delete mode 100644 common-library/src/main/java/com/yas/commonlibrary/CommonLibraryApplication.java diff --git a/cart/pom.xml b/cart/pom.xml index deb2ea453b..78dbecce66 100644 --- a/cart/pom.xml +++ b/cart/pom.xml @@ -52,7 +52,7 @@ com.yas common-library - 1.0-SNAPSHOT + ${revision} diff --git a/common-library/src/main/java/com/yas/commonlibrary/CommonLibraryApplication.java b/common-library/src/main/java/com/yas/commonlibrary/CommonLibraryApplication.java deleted file mode 100644 index 09bd29eaf1..0000000000 --- a/common-library/src/main/java/com/yas/commonlibrary/CommonLibraryApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.yas.commonlibrary; - -import com.yas.commonlibrary.config.ServiceUrlConfig; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.context.properties.EnableConfigurationProperties; - -@SpringBootApplication -@EnableConfigurationProperties(ServiceUrlConfig.class) -public class CommonLibraryApplication { - - public static void main(String[] args) { - SpringApplication.run(CommonLibraryApplication.class, args); - } -} \ No newline at end of file diff --git a/customer/pom.xml b/customer/pom.xml index cbca8d4053..063d74a1d2 100644 --- a/customer/pom.xml +++ b/customer/pom.xml @@ -63,7 +63,7 @@ com.yas common-library - 1.0-SNAPSHOT + ${revision} diff --git a/inventory/pom.xml b/inventory/pom.xml index 433b629e40..efb95e67c4 100644 --- a/inventory/pom.xml +++ b/inventory/pom.xml @@ -55,7 +55,7 @@ com.yas common-library - 1.0-SNAPSHOT + ${revision} diff --git a/location/pom.xml b/location/pom.xml index 78f57068a9..fc301e870f 100644 --- a/location/pom.xml +++ b/location/pom.xml @@ -55,7 +55,7 @@ com.yas common-library - 1.0-SNAPSHOT + ${revision} diff --git a/product/pom.xml b/product/pom.xml index fca7f882c4..d39f865f10 100644 --- a/product/pom.xml +++ b/product/pom.xml @@ -65,7 +65,7 @@ com.yas common-library - 1.0-SNAPSHOT + ${revision} From d8116559f7e6d0e9d398af66919a362b623257d3 Mon Sep 17 00:00:00 2001 From: nashtech-huyphamphu Date: Thu, 19 Sep 2024 09:37:33 +0700 Subject: [PATCH 5/7] #882 Create a shared project --- .../com/yas/cart/config/RestClientConfig.java | 15 ------------- .../yas/commonlibrary}/config/CorsConfig.java | 2 +- .../config/RestClientConfig.java | 2 +- .../com/yas/customer/config/CorsConfig.java | 20 ------------------ .../yas/customer/config/RestClientConfig.java | 15 ------------- .../com/yas/inventory/config/CorsConfig.java | 19 ----------------- .../com/yas/location/config/CorsConfig.java | 21 ------------------- .../yas/location/config/RestClientConfig.java | 15 ------------- .../com/yas/product/config/CorsConfig.java | 20 ------------------ 9 files changed, 2 insertions(+), 127 deletions(-) delete mode 100644 cart/src/main/java/com/yas/cart/config/RestClientConfig.java rename {cart/src/main/java/com/yas/cart => common-library/src/main/java/com/yas/commonlibrary}/config/CorsConfig.java (94%) rename {inventory/src/main/java/com/yas/inventory => common-library/src/main/java/com/yas/commonlibrary}/config/RestClientConfig.java (89%) delete mode 100644 customer/src/main/java/com/yas/customer/config/CorsConfig.java delete mode 100644 customer/src/main/java/com/yas/customer/config/RestClientConfig.java delete mode 100644 inventory/src/main/java/com/yas/inventory/config/CorsConfig.java delete mode 100644 location/src/main/java/com/yas/location/config/CorsConfig.java delete mode 100644 location/src/main/java/com/yas/location/config/RestClientConfig.java delete mode 100644 product/src/main/java/com/yas/product/config/CorsConfig.java diff --git a/cart/src/main/java/com/yas/cart/config/RestClientConfig.java b/cart/src/main/java/com/yas/cart/config/RestClientConfig.java deleted file mode 100644 index 191499ac48..0000000000 --- a/cart/src/main/java/com/yas/cart/config/RestClientConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.yas.cart.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.client.RestClient; - -@Configuration -public class RestClientConfig { - - @Bean - public RestClient restClient() { - return RestClient.builder().build(); - } - -} diff --git a/cart/src/main/java/com/yas/cart/config/CorsConfig.java b/common-library/src/main/java/com/yas/commonlibrary/config/CorsConfig.java similarity index 94% rename from cart/src/main/java/com/yas/cart/config/CorsConfig.java rename to common-library/src/main/java/com/yas/commonlibrary/config/CorsConfig.java index 87af701f45..b17001b554 100644 --- a/cart/src/main/java/com/yas/cart/config/CorsConfig.java +++ b/common-library/src/main/java/com/yas/commonlibrary/config/CorsConfig.java @@ -1,4 +1,4 @@ -package com.yas.cart.config; +package com.yas.commonlibrary.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/inventory/src/main/java/com/yas/inventory/config/RestClientConfig.java b/common-library/src/main/java/com/yas/commonlibrary/config/RestClientConfig.java similarity index 89% rename from inventory/src/main/java/com/yas/inventory/config/RestClientConfig.java rename to common-library/src/main/java/com/yas/commonlibrary/config/RestClientConfig.java index ba18958ecc..52cabe60a0 100644 --- a/inventory/src/main/java/com/yas/inventory/config/RestClientConfig.java +++ b/common-library/src/main/java/com/yas/commonlibrary/config/RestClientConfig.java @@ -1,4 +1,4 @@ -package com.yas.inventory.config; +package com.yas.commonlibrary.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/customer/src/main/java/com/yas/customer/config/CorsConfig.java b/customer/src/main/java/com/yas/customer/config/CorsConfig.java deleted file mode 100644 index 1f75f5ce9b..0000000000 --- a/customer/src/main/java/com/yas/customer/config/CorsConfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yas.customer.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class CorsConfig { - @Bean - public WebMvcConfigurer corsConfigure() { - return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**").allowedMethods("*").allowedOrigins("*") - .allowedHeaders("*"); - } - }; - } -} diff --git a/customer/src/main/java/com/yas/customer/config/RestClientConfig.java b/customer/src/main/java/com/yas/customer/config/RestClientConfig.java deleted file mode 100644 index 317d233766..0000000000 --- a/customer/src/main/java/com/yas/customer/config/RestClientConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.yas.customer.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.client.RestClient; - -@Configuration -public class RestClientConfig { - - @Bean - public RestClient restClient() { - return RestClient.builder().build(); - } - -} diff --git a/inventory/src/main/java/com/yas/inventory/config/CorsConfig.java b/inventory/src/main/java/com/yas/inventory/config/CorsConfig.java deleted file mode 100644 index 3bea3e4bd7..0000000000 --- a/inventory/src/main/java/com/yas/inventory/config/CorsConfig.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.yas.inventory.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class CorsConfig { - @Bean - public WebMvcConfigurer corsConfigure() { - return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**").allowedMethods("*").allowedOrigins("*").allowedHeaders("*"); //NOSONAR - } - }; - } -} diff --git a/location/src/main/java/com/yas/location/config/CorsConfig.java b/location/src/main/java/com/yas/location/config/CorsConfig.java deleted file mode 100644 index b6e5199bee..0000000000 --- a/location/src/main/java/com/yas/location/config/CorsConfig.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.yas.location.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class CorsConfig { - - @Bean - public WebMvcConfigurer corsConfigure() { - return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**").allowedMethods("*").allowedOrigins("*") //NOSONAR - .allowedHeaders("*"); - } - }; - } -} diff --git a/location/src/main/java/com/yas/location/config/RestClientConfig.java b/location/src/main/java/com/yas/location/config/RestClientConfig.java deleted file mode 100644 index d5ad3b0a17..0000000000 --- a/location/src/main/java/com/yas/location/config/RestClientConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.yas.location.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.client.RestClient; - -@Configuration -public class RestClientConfig { - - @Bean - public RestClient restClient() { - return RestClient.builder().build(); - } - -} diff --git a/product/src/main/java/com/yas/product/config/CorsConfig.java b/product/src/main/java/com/yas/product/config/CorsConfig.java deleted file mode 100644 index 79f2f74d31..0000000000 --- a/product/src/main/java/com/yas/product/config/CorsConfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yas.product.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.CorsRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class CorsConfig { - @Bean - public WebMvcConfigurer corsConfigure() { - return new WebMvcConfigurer() { - @Override - public void addCorsMappings(CorsRegistry registry) { - registry.addMapping("/**").allowedMethods("*").allowedOrigins("*") - .allowedHeaders("*"); - } - }; - } -} From c6bea0615325498231ef44455fc1bcca3aeb517a Mon Sep 17 00:00:00 2001 From: nashtech-huyphamphu Date: Thu, 19 Sep 2024 12:17:10 +0700 Subject: [PATCH 6/7] #882 Create a shared project --- cart/src/it/java/com/yas/cart/service/ProductServiceIT.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cart/src/it/java/com/yas/cart/service/ProductServiceIT.java b/cart/src/it/java/com/yas/cart/service/ProductServiceIT.java index cf5d91995e..b6d90ad9a6 100644 --- a/cart/src/it/java/com/yas/cart/service/ProductServiceIT.java +++ b/cart/src/it/java/com/yas/cart/service/ProductServiceIT.java @@ -13,12 +13,14 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.boot.testcontainers.service.connection.ServiceConnection; +import org.springframework.context.annotation.ComponentScan; import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; @SpringBootTest @Testcontainers +@ComponentScan(basePackages = {"com.yas.commonlibrary"}) class ProductServiceIT { @Container @ServiceConnection From bac0a79cba4f6ddf5211bceaad236de1d8add853 Mon Sep 17 00:00:00 2001 From: nashtech-huyphamphu Date: Thu, 19 Sep 2024 13:52:40 +0700 Subject: [PATCH 7/7] #882 Create a shared project --- .../java/com/yas/cart}/config/CorsConfig.java | 2 +- .../yas/cart}/config/RestClientConfig.java | 2 +- .../com/yas/customer/config/CorsConfig.java | 20 +++++++++++++++++++ .../yas/customer/config/RestClientConfig.java | 15 ++++++++++++++ .../com/yas/inventory/config/CorsConfig.java | 20 +++++++++++++++++++ .../inventory/config/RestClientConfig.java | 15 ++++++++++++++ .../com/yas/location/config/CorsConfig.java | 20 +++++++++++++++++++ .../yas/location/config/RestClientConfig.java | 15 ++++++++++++++ .../com/yas/product/config/CorsConfig.java | 20 +++++++++++++++++++ 9 files changed, 127 insertions(+), 2 deletions(-) rename {common-library/src/main/java/com/yas/commonlibrary => cart/src/main/java/com/yas/cart}/config/CorsConfig.java (94%) rename {common-library/src/main/java/com/yas/commonlibrary => cart/src/main/java/com/yas/cart}/config/RestClientConfig.java (89%) create mode 100644 customer/src/main/java/com/yas/customer/config/CorsConfig.java create mode 100644 customer/src/main/java/com/yas/customer/config/RestClientConfig.java create mode 100644 inventory/src/main/java/com/yas/inventory/config/CorsConfig.java create mode 100644 inventory/src/main/java/com/yas/inventory/config/RestClientConfig.java create mode 100644 location/src/main/java/com/yas/location/config/CorsConfig.java create mode 100644 location/src/main/java/com/yas/location/config/RestClientConfig.java create mode 100644 product/src/main/java/com/yas/product/config/CorsConfig.java diff --git a/common-library/src/main/java/com/yas/commonlibrary/config/CorsConfig.java b/cart/src/main/java/com/yas/cart/config/CorsConfig.java similarity index 94% rename from common-library/src/main/java/com/yas/commonlibrary/config/CorsConfig.java rename to cart/src/main/java/com/yas/cart/config/CorsConfig.java index b17001b554..87af701f45 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/config/CorsConfig.java +++ b/cart/src/main/java/com/yas/cart/config/CorsConfig.java @@ -1,4 +1,4 @@ -package com.yas.commonlibrary.config; +package com.yas.cart.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/common-library/src/main/java/com/yas/commonlibrary/config/RestClientConfig.java b/cart/src/main/java/com/yas/cart/config/RestClientConfig.java similarity index 89% rename from common-library/src/main/java/com/yas/commonlibrary/config/RestClientConfig.java rename to cart/src/main/java/com/yas/cart/config/RestClientConfig.java index 52cabe60a0..191499ac48 100644 --- a/common-library/src/main/java/com/yas/commonlibrary/config/RestClientConfig.java +++ b/cart/src/main/java/com/yas/cart/config/RestClientConfig.java @@ -1,4 +1,4 @@ -package com.yas.commonlibrary.config; +package com.yas.cart.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/customer/src/main/java/com/yas/customer/config/CorsConfig.java b/customer/src/main/java/com/yas/customer/config/CorsConfig.java new file mode 100644 index 0000000000..f9e665a312 --- /dev/null +++ b/customer/src/main/java/com/yas/customer/config/CorsConfig.java @@ -0,0 +1,20 @@ +package com.yas.customer.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class CorsConfig { + @Bean + public WebMvcConfigurer corsConfigure() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("*").allowedOrigins("*") + .allowedHeaders("*"); + } + }; + } +} diff --git a/customer/src/main/java/com/yas/customer/config/RestClientConfig.java b/customer/src/main/java/com/yas/customer/config/RestClientConfig.java new file mode 100644 index 0000000000..317d233766 --- /dev/null +++ b/customer/src/main/java/com/yas/customer/config/RestClientConfig.java @@ -0,0 +1,15 @@ +package com.yas.customer.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestClient; + +@Configuration +public class RestClientConfig { + + @Bean + public RestClient restClient() { + return RestClient.builder().build(); + } + +} diff --git a/inventory/src/main/java/com/yas/inventory/config/CorsConfig.java b/inventory/src/main/java/com/yas/inventory/config/CorsConfig.java new file mode 100644 index 0000000000..6c18759dcf --- /dev/null +++ b/inventory/src/main/java/com/yas/inventory/config/CorsConfig.java @@ -0,0 +1,20 @@ +package com.yas.inventory.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class CorsConfig { + @Bean + public WebMvcConfigurer corsConfigure() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("*").allowedOrigins("*") + .allowedHeaders("*"); + } + }; + } +} diff --git a/inventory/src/main/java/com/yas/inventory/config/RestClientConfig.java b/inventory/src/main/java/com/yas/inventory/config/RestClientConfig.java new file mode 100644 index 0000000000..ba18958ecc --- /dev/null +++ b/inventory/src/main/java/com/yas/inventory/config/RestClientConfig.java @@ -0,0 +1,15 @@ +package com.yas.inventory.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestClient; + +@Configuration +public class RestClientConfig { + + @Bean + public RestClient restClient() { + return RestClient.builder().build(); + } + +} diff --git a/location/src/main/java/com/yas/location/config/CorsConfig.java b/location/src/main/java/com/yas/location/config/CorsConfig.java new file mode 100644 index 0000000000..7b7f9d35bf --- /dev/null +++ b/location/src/main/java/com/yas/location/config/CorsConfig.java @@ -0,0 +1,20 @@ +package com.yas.location.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class CorsConfig { + @Bean + public WebMvcConfigurer corsConfigure() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("*").allowedOrigins("*") + .allowedHeaders("*"); + } + }; + } +} diff --git a/location/src/main/java/com/yas/location/config/RestClientConfig.java b/location/src/main/java/com/yas/location/config/RestClientConfig.java new file mode 100644 index 0000000000..d5ad3b0a17 --- /dev/null +++ b/location/src/main/java/com/yas/location/config/RestClientConfig.java @@ -0,0 +1,15 @@ +package com.yas.location.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestClient; + +@Configuration +public class RestClientConfig { + + @Bean + public RestClient restClient() { + return RestClient.builder().build(); + } + +} diff --git a/product/src/main/java/com/yas/product/config/CorsConfig.java b/product/src/main/java/com/yas/product/config/CorsConfig.java new file mode 100644 index 0000000000..4996d15f98 --- /dev/null +++ b/product/src/main/java/com/yas/product/config/CorsConfig.java @@ -0,0 +1,20 @@ +package com.yas.product.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class CorsConfig { + @Bean + public WebMvcConfigurer corsConfigure() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**").allowedMethods("*").allowedOrigins("*") + .allowedHeaders("*"); + } + }; + } +}