From 202f0435ae4f14ead8c0c8ced5622ac4f4196af2 Mon Sep 17 00:00:00 2001 From: shekhar16 Date: Sun, 24 Sep 2023 18:29:09 +0530 Subject: [PATCH] feat(oxtrust-server):#2371 add search field for scopes selection in client --- .../oxtrust/action/UpdateClientAction.java | 24 +++++++++++++++---- server/src/main/webapp/client/addClient.xhtml | 5 ++-- .../src/main/webapp/client/updateClient.xhtml | 5 ++-- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java b/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java index 13b46276f..64f40c7e5 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java @@ -205,6 +205,7 @@ public class UpdateClientAction implements Serializable { private String spontaneousScopeCustomScript; private String introspectionCustomScript; private String rptClaimsScript; + private String scopePattern; Pattern domainPattern = Pattern.compile("^((?!-)[A-Za-z0-9-]{1,63}(? client.getAttributes().getPostAuthnScripts().contains(entity.getEntity().getDn())) @@ -1529,14 +1532,17 @@ public List getScripts(CustomScriptType type) { } public void searchAvailableScopes() { - if (this.availableScopes != null) { - selectAddedScopes(); - return; - } + /* + * if (this.availableScopes != null) { selectAddedScopes(); return; } + */ List> tmpAvailableScopes = new ArrayList>(); List scopes = new ArrayList(); try { - scopes = scopeService.getAllScopesList(1000); + if(scopePattern != null && !scopePattern.isEmpty()) { + scopes = scopeService.searchScopes(scopePattern, 0); + }else { + scopes = scopeService.getAllScopesList(1000); + } } catch (Exception e) { e.printStackTrace(); } @@ -2241,4 +2247,12 @@ public String getAvailableRedirectLogoutUrl() { public void setAvailableRedirectLogoutUrl(String availableRedirectLogoutUrl) { this.availableRedirectLogoutUrl = availableRedirectLogoutUrl; } + + public String getScopePattern() { + return scopePattern; + } + + public void setScopePattern(String scopePattern) { + this.scopePattern = scopePattern; + } } diff --git a/server/src/main/webapp/client/addClient.xhtml b/server/src/main/webapp/client/addClient.xhtml index 954272eeb..d6767295d 100644 --- a/server/src/main/webapp/client/addClient.xhtml +++ b/server/src/main/webapp/client/addClient.xhtml @@ -78,11 +78,12 @@ + searchResult="#{updateClientAction.availableScopes}" + searchPattern="#{updateClientAction.scopePattern}"/> + searchResult="#{updateClientAction.availableScopes}" + searchPattern="#{updateClientAction.scopePattern}"/>