From 3d2b47ad1413bc3b0146157d2990a3d2af342607 Mon Sep 17 00:00:00 2001 From: Frederik Hahne Date: Thu, 30 Nov 2023 20:39:52 +0100 Subject: [PATCH] add jhipster property to configured custom auth0 uris updates https://github.com/jhipster/generator-jhipster/issues/22020 --- .../java/tech/jhipster/config/JHipsterProperties.java | 10 ++++++++++ .../tech/jhipster/config/JHipsterPropertiesTest.java | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/jhipster-framework/src/main/java/tech/jhipster/config/JHipsterProperties.java b/jhipster-framework/src/main/java/tech/jhipster/config/JHipsterProperties.java index 7fa2e91c7..bb86c7043 100644 --- a/jhipster-framework/src/main/java/tech/jhipster/config/JHipsterProperties.java +++ b/jhipster-framework/src/main/java/tech/jhipster/config/JHipsterProperties.java @@ -850,6 +850,8 @@ public void setKey(String key) { public static class OAuth2 { private List audience = new ArrayList<>(); + private List auth0IssuerUris = new ArrayList<>(); + public List getAudience() { return Collections.unmodifiableList(audience); } @@ -857,6 +859,14 @@ public List getAudience() { public void setAudience(@NotNull List audience) { this.audience.addAll(audience); } + + public List getAuth0IssuerUris() { + return Collections.unmodifiableList(auth0IssuerUris); + } + + public void setAuth0IssuerUris(List auth0IssuerUris) { + this.auth0IssuerUris.addAll(auth0IssuerUris); + } } } diff --git a/jhipster-framework/src/test/java/tech/jhipster/config/JHipsterPropertiesTest.java b/jhipster-framework/src/test/java/tech/jhipster/config/JHipsterPropertiesTest.java index d74903b72..5ef829492 100644 --- a/jhipster-framework/src/test/java/tech/jhipster/config/JHipsterPropertiesTest.java +++ b/jhipster-framework/src/test/java/tech/jhipster/config/JHipsterPropertiesTest.java @@ -539,6 +539,17 @@ void testSecurityOauth2Audience() { assertThat(obj.getAudience()).contains("default", "account"); } + @Test + void testSecurityOauth2Auth0IssuerUris() { + JHipsterProperties.Security.OAuth2 obj = properties.getSecurity().getOauth2(); + assertThat(obj).isNotNull(); + assertThat(obj.getAuth0IssuerUris()).isNotNull().isEmpty(); + + obj.setAuth0IssuerUris(Arrays.asList("auth0.com", "my-custom-auth0.org")); + assertThat(obj.getAuth0IssuerUris()).isNotEmpty().size().isEqualTo(2); + assertThat(obj.getAuth0IssuerUris()).contains("auth0.com", "my-custom-auth0.org"); + } + @Test void testApiDocsTitle() { JHipsterProperties.ApiDocs obj = properties.getApiDocs();