From fda26385ec7cbac294cb57de529de30db3207bb3 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Mon, 10 Oct 2022 08:00:50 +0200 Subject: [PATCH] Add profile feature for hosting keycloak.js on the server (#14771) * Add profile feature for hosting keycloak.js on the server Closes #14770 * Updated txt files for HelpCommandTest --- common/src/main/java/org/keycloak/common/Profile.java | 3 ++- .../cli/help/HelpCommandTest.testBuildHelp.unix.approved.txt | 4 ++-- .../help/HelpCommandTest.testBuildHelp.windows.approved.txt | 4 ++-- .../help/HelpCommandTest.testStartDevHelp.unix.approved.txt | 4 ++-- .../HelpCommandTest.testStartDevHelp.windows.approved.txt | 4 ++-- .../HelpCommandTest.testStartDevHelpAll.unix.approved.txt | 4 ++-- .../HelpCommandTest.testStartDevHelpAll.windows.approved.txt | 4 ++-- .../cli/help/HelpCommandTest.testStartHelp.unix.approved.txt | 4 ++-- .../help/HelpCommandTest.testStartHelp.windows.approved.txt | 4 ++-- .../help/HelpCommandTest.testStartHelpAll.unix.approved.txt | 4 ++-- .../HelpCommandTest.testStartHelpAll.windows.approved.txt | 4 ++-- .../org/keycloak/services/resources/KeycloakApplication.java | 5 ++++- 12 files changed, 26 insertions(+), 22 deletions(-) diff --git a/common/src/main/java/org/keycloak/common/Profile.java b/common/src/main/java/org/keycloak/common/Profile.java index 0761472477..9c66517b29 100755 --- a/common/src/main/java/org/keycloak/common/Profile.java +++ b/common/src/main/java/org/keycloak/common/Profile.java @@ -191,7 +191,8 @@ public class Profile { CLIENT_SECRET_ROTATION("Client Secret Rotation", Type.PREVIEW), STEP_UP_AUTHENTICATION("Step-up Authentication", Type.DEFAULT), RECOVERY_CODES("Recovery codes", Type.PREVIEW), - UPDATE_EMAIL("Update Email Action", Type.PREVIEW); + UPDATE_EMAIL("Update Email Action", Type.PREVIEW), + JS_ADAPTER("Host keycloak.js and keycloak-authz.js through the Keycloak sever", Type.DEFAULT); private final Type typeProject; diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.unix.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.unix.approved.txt index 8ae1b9cafd..5b405bcb3a 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.unix.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.unix.approved.txt @@ -48,14 +48,14 @@ Feature: docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin-api, admin, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. HTTP/TLS: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.windows.approved.txt index 5ab0939a4f..431aeabdc9 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.windows.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testBuildHelp.windows.approved.txt @@ -48,14 +48,14 @@ Feature: impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, step-up-authentication, - recovery-codes, update-email, preview. + recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, step-up-authentication, - recovery-codes, update-email, preview. + recovery-codes, update-email, js-adapter, preview. HTTP/TLS: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.unix.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.unix.approved.txt index df5fcdb8f2..b3074df076 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.unix.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.unix.approved.txt @@ -71,14 +71,14 @@ Feature: docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin-api, admin, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. Hostname: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.windows.approved.txt index 6d268713a2..a1941f2410 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.windows.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelp.windows.approved.txt @@ -71,14 +71,14 @@ Feature: impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, step-up-authentication, - recovery-codes, update-email, preview. + recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, step-up-authentication, - recovery-codes, update-email, preview. + recovery-codes, update-email, js-adapter, preview. Hostname: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.unix.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.unix.approved.txt index 6401054e80..0f1df3d36f 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.unix.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.unix.approved.txt @@ -132,14 +132,14 @@ Feature: docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin-api, admin, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. Hostname: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.windows.approved.txt index eb56e899ef..f06de863eb 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.windows.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartDevHelpAll.windows.approved.txt @@ -132,14 +132,14 @@ Feature: docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin-api, admin, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. Hostname: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.unix.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.unix.approved.txt index 87ed2c982b..9c44c129b5 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.unix.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.unix.approved.txt @@ -77,14 +77,14 @@ Feature: docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin-api, admin, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. Hostname: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.windows.approved.txt index 3344d2c475..357cf6f4dd 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.windows.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelp.windows.approved.txt @@ -77,14 +77,14 @@ Feature: impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, step-up-authentication, - recovery-codes, update-email, preview. + recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, step-up-authentication, - recovery-codes, update-email, preview. + recovery-codes, update-email, js-adapter, preview. Hostname: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelpAll.unix.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelpAll.unix.approved.txt index e4af4f7337..7835efc65c 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelpAll.unix.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelpAll.unix.approved.txt @@ -138,14 +138,14 @@ Feature: docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin-api, admin, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. Hostname: diff --git a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelpAll.windows.approved.txt b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelpAll.windows.approved.txt index 94220d6d44..eaaae35054 100644 --- a/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelpAll.windows.approved.txt +++ b/quarkus/tests/integration/src/test/resources/org/keycloak/it/cli/approvals/cli/help/HelpCommandTest.testStartHelpAll.windows.approved.txt @@ -138,14 +138,14 @@ Feature: docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. --features-disabled Disables a set of one or more features. Possible values are: authorization, account2, account-api, admin-fine-grained-authz, admin-api, admin, admin2, docker, impersonation, openshift-integration, scripts, token-exchange, web-authn, client-policies, ciba, map-storage, par, declarative-user-profile, dynamic-scopes, client-secret-rotation, - step-up-authentication, recovery-codes, update-email, preview. + step-up-authentication, recovery-codes, update-email, js-adapter, preview. Hostname: diff --git a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java index d690f74634..eae9a2ea35 100644 --- a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java +++ b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java @@ -105,7 +105,10 @@ public class KeycloakApplication extends Application { singletons.add(new AdminRoot()); } classes.add(ThemeResource.class); - classes.add(JsResource.class); + + if (Profile.isFeatureEnabled(Profile.Feature.JS_ADAPTER)) { + classes.add(JsResource.class); + } classes.add(KeycloakSecurityHeadersFilter.class); classes.add(KeycloakErrorHandler.class);