Skip to content

Commit

Permalink
feat(oxtrust-server):#2371 add search field for scopes selection in
Browse files Browse the repository at this point in the history
client
  • Loading branch information
shekhar16 committed Sep 24, 2023
1 parent e46f0f9 commit 202f043
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}(?<!-)\\\\.)+[A-Za-z]{2,6}");
Expand Down Expand Up @@ -267,6 +268,7 @@ public String add() throws Exception {
this.spontaneousScopesScripts = Lists.newArrayList();
this.backchannelLogoutUri = getStringFromList(client.getAttributes().getBackchannelLogoutUri());
this.tlsSubjectDn = client.getAttributes().getTlsClientAuthSubjectDn();
this.scopePattern = "";
this.redirectLogoutUrl = getNonEmptyStringList(client.getOxAuthPostLogoutRedirectURIs());
searchAvailableCustomScriptsforAcr();
} catch (BasePersistenceException ex) {
Expand Down Expand Up @@ -340,6 +342,7 @@ public String update() throws Exception {
this.claimRedirectURIList = getNonEmptyStringList(client.getClaimRedirectURI());
this.additionalAudienceList = getNonEmptyStringList(client.getAttributes().getAdditionalAudience());
this.tlsSubjectDn = client.getAttributes().getTlsClientAuthSubjectDn();
this.scopePattern = "";

this.postAuthnScripts = searchAvailablePostAuthnCustomScripts().stream()
.filter(entity -> client.getAttributes().getPostAuthnScripts().contains(entity.getEntity().getDn()))
Expand Down Expand Up @@ -1529,14 +1532,17 @@ public List<CustomScript> getScripts(CustomScriptType type) {
}

public void searchAvailableScopes() {
if (this.availableScopes != null) {
selectAddedScopes();
return;
}
/*
* if (this.availableScopes != null) { selectAddedScopes(); return; }
*/
List<SelectableEntity<Scope>> tmpAvailableScopes = new ArrayList<SelectableEntity<Scope>>();
List<Scope> scopes = new ArrayList<Scope>();
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();
}
Expand Down Expand Up @@ -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;
}
}
5 changes: 3 additions & 2 deletions server/src/main/webapp/client/addClient.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@
<ox:selectSelectableEntityDialog
acceptMethod="#{updateClientAction.acceptSelectScopes()}"
cancelMethod="#{updateClientAction.cancelSelectScopes()}"
displayNameProperty="entity.description" displaySearchForm="false"
displayNameProperty="entity.description" displaySearchForm="true"
id="scope" label="#{msgs['client.scopes']}"
nameProperty="entity.id" render="selectedScopesId"
searchMethod="#{updateClientAction.searchAvailableScopes}"
searchResult="#{updateClientAction.availableScopes}" />
searchResult="#{updateClientAction.availableScopes}"
searchPattern="#{updateClientAction.scopePattern}"/>

<ox:selectSelectableEntityDialog
acceptMethod="#{updateClientAction.acceptSelectResponseTypes}"
Expand Down
5 changes: 3 additions & 2 deletions server/src/main/webapp/client/updateClient.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@
<ox:selectSelectableEntityDialog
acceptMethod="#{updateClientAction.acceptSelectScopes()}"
cancelMethod="#{updateClientAction.cancelSelectScopes()}"
displayNameProperty="entity.description" displaySearchForm="false"
displayNameProperty="entity.description" displaySearchForm="true"
id="scope" label="#{msgs['client.scopes']}" nameProperty="entity.id"
render="selectedScopesId"
searchMethod="#{updateClientAction.searchAvailableScopes}"
searchResult="#{updateClientAction.availableScopes}" />
searchResult="#{updateClientAction.availableScopes}"
searchPattern="#{updateClientAction.scopePattern}"/>

<ox:selectSelectableEntityDialog
acceptMethod="#{updateClientAction.acceptSelectResponseTypes}"
Expand Down

0 comments on commit 202f043

Please sign in to comment.