From 5a53d53b50dd0b559254a7008b5db69e08e64f1b Mon Sep 17 00:00:00 2001 From: Yuriy Movchan Date: Thu, 16 Jan 2025 13:54:14 +0300 Subject: [PATCH] feat(jans-auth): Show valid client name or id in consent form (#10649) Signed-off-by: Yuriy Movchan --- .../sample-script/ConsentGatheringSample.py | 2 +- .../server/authorize/ws/rs/AuthorizeAction.java | 16 +++++++++++++++- .../layout/authorize-extended-template.xhtml | 2 +- .../consent_gathering/ConsentGatheringSample.py | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/docs/script-catalog/consent_gathering/sample-script/ConsentGatheringSample.py b/docs/script-catalog/consent_gathering/sample-script/ConsentGatheringSample.py index 40576be19b1..f0a48a0a49d 100644 --- a/docs/script-catalog/consent_gathering/sample-script/ConsentGatheringSample.py +++ b/docs/script-catalog/consent_gathering/sample-script/ConsentGatheringSample.py @@ -30,7 +30,7 @@ def destroy(self, configurationAttributes): return True def getApiVersion(self): - return 1 + return 11 # Main consent-gather method. Must return True (if gathering performed successfully) or False (if fail). # All user entered values can be access via Map context.getPageAttributes() diff --git a/jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizeAction.java b/jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizeAction.java index a5a96ce2de4..35384a724db 100644 --- a/jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizeAction.java +++ b/jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizeAction.java @@ -989,6 +989,20 @@ public String getClientDisplayName() { } final Client client = clientService.getClient(clientId); + return getCheckedClientDisplayName(client); + } + + public String getClientDisplayName(final Client client) { + log.trace("client {}", client); + + if (client == null) { + getClientDisplayName(); + } + + return getCheckedClientDisplayName(client); + } + + private String getCheckedClientDisplayName(final Client client) { if (StringUtils.isNotBlank(client.getClientName())) { return client.getClientName(); } @@ -998,7 +1012,7 @@ public String getClientDisplayName() { } return "Unknown"; - } + } public String getAuthReqId() { return authReqId; diff --git a/jans-auth-server/server/src/main/webapp/WEB-INF/incl/layout/authorize-extended-template.xhtml b/jans-auth-server/server/src/main/webapp/WEB-INF/incl/layout/authorize-extended-template.xhtml index e8b03eafc30..37ca0a66712 100644 --- a/jans-auth-server/server/src/main/webapp/WEB-INF/incl/layout/authorize-extended-template.xhtml +++ b/jans-auth-server/server/src/main/webapp/WEB-INF/incl/layout/authorize-extended-template.xhtml @@ -46,7 +46,7 @@ + value="#{authorizeAction.getClientDisplayName(client)}" />

diff --git a/jans-linux-setup/jans_setup/static/extension/consent_gathering/ConsentGatheringSample.py b/jans-linux-setup/jans_setup/static/extension/consent_gathering/ConsentGatheringSample.py index 40576be19b1..f0a48a0a49d 100644 --- a/jans-linux-setup/jans_setup/static/extension/consent_gathering/ConsentGatheringSample.py +++ b/jans-linux-setup/jans_setup/static/extension/consent_gathering/ConsentGatheringSample.py @@ -30,7 +30,7 @@ def destroy(self, configurationAttributes): return True def getApiVersion(self): - return 1 + return 11 # Main consent-gather method. Must return True (if gathering performed successfully) or False (if fail). # All user entered values can be access via Map context.getPageAttributes()