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 6c4fb47e5..524304749 100644 --- a/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java +++ b/server/src/main/java/org/gluu/oxtrust/action/UpdateClientAction.java @@ -162,6 +162,7 @@ public class UpdateClientAction implements Serializable { private List loginUris = Lists.newArrayList(); private List logoutUris; private List clientlogoutUris; + private List redirectLogoutUrl; private List clientBackChannellogoutUris; private List claimRedirectURIList; private List additionalAudienceList; @@ -188,6 +189,7 @@ public class UpdateClientAction implements Serializable { private String availableLoginUri = HTTPS; private String availableLogoutUri = HTTPS; private String availableClientlogoutUri = HTTPS; + private String availableRedirectLogoutUrl = HTTPS; private String availableClientBacklogoutUri = HTTPS; private String availableContact = ""; private String availableRequestUri = HTTPS; @@ -201,6 +203,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())) @@ -417,6 +424,7 @@ public String save() throws Exception { } updateLoginURIs(); updateLogoutURIs(); + updateRedirectLogoutUrls(); updateBackChannelLogoutURIs(); updateScopes(); updateClaims(); @@ -534,6 +542,10 @@ public void removeLogoutURI(String uri) { public void removeClientLogoutURI(String uri) { removeFromList(this.clientlogoutUris, uri); } + + public void removeRedirectLogoutUrl(String uri) { + removeFromList(this.redirectLogoutUrl, uri); + } public void removeClientBackLogoutURI(String uri) { removeFromList(this.clientBackChannellogoutUris, uri); @@ -804,6 +816,19 @@ && checkBlackListRedirectUris(availableLogoutUri)) { this.availableLogoutUri = HTTPS; } + public void acceptSelectRedirectLogoutUrl() { + if (StringHelper.isEmpty(this.availableRedirectLogoutUrl)) { + return; + } + if (this.availableRedirectLogoutUrl.equalsIgnoreCase(HTTPS)) { + return; + } + if (!this.redirectLogoutUrl.contains(this.availableRedirectLogoutUrl)) { + this.redirectLogoutUrl.add(this.availableRedirectLogoutUrl); + } + this.availableRedirectLogoutUrl = HTTPS; + } + public void acceptSelectClientLogoutUri() { if (StringHelper.isEmpty(this.availableClientlogoutUri)) { return; @@ -924,6 +949,10 @@ public void cancelClientLogoutUri() { this.availableClientlogoutUri = HTTPS; } + public void cancelRedirectLogoutUrl() { + this.availableRedirectLogoutUrl = HTTPS; + } + public void cancelClientBackLogoutUri() { this.availableClientBacklogoutUri = HTTPS; } @@ -973,6 +1002,18 @@ private void updateLogoutURIs() { this.client.setLogoutUri(tmpUris); } + private void updateRedirectLogoutUrls() { + if (this.redirectLogoutUrl == null || this.redirectLogoutUrl.size() == 0) { + this.client.setOxAuthPostLogoutRedirectURIs(null); + return; + } + List tmpUris = new ArrayList(); + for (String uri : this.redirectLogoutUrl) { + tmpUris.add(StringHelper.trimAll(uri)); + } + this.client.setOxAuthPostLogoutRedirectURIs(tmpUris); + } + private void updateBackChannelLogoutURIs() { if (this.clientBackChannellogoutUris == null || this.clientBackChannellogoutUris.size() == 0) { client.getAttributes().setBackchannelLogoutUri(new ArrayList()); @@ -1489,14 +1530,18 @@ 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(); } @@ -2164,6 +2209,7 @@ public void setResources(List resources) { this.resources = resources; } + public List getClientBackChannellogoutUris() { return clientBackChannellogoutUris; } @@ -2179,4 +2225,28 @@ public String getAvailableClientBacklogoutUri() { public void setAvailableClientBacklogoutUri(String availableClientBacklogoutUri) { this.availableClientBacklogoutUri = availableClientBacklogoutUri; } + + public String getScopePattern() { + return scopePattern; + } + + public void setScopePattern(String scopePattern) { + this.scopePattern = scopePattern; + } + + public List getRedirectLogoutUrl() { + return redirectLogoutUrl; + } + + public void setRedirectLogoutUrl(List redirectLogoutUrl) { + this.redirectLogoutUrl = redirectLogoutUrl; + } + + public String getAvailableRedirectLogoutUrl() { + return availableRedirectLogoutUrl; + } + + public void setAvailableRedirectLogoutUrl(String availableRedirectLogoutUrl) { + this.availableRedirectLogoutUrl = availableRedirectLogoutUrl; + } } diff --git a/server/src/main/java/org/gluu/oxtrust/model/OxAuthClient.java b/server/src/main/java/org/gluu/oxtrust/model/OxAuthClient.java index d0dee9055..f7062de39 100644 --- a/server/src/main/java/org/gluu/oxtrust/model/OxAuthClient.java +++ b/server/src/main/java/org/gluu/oxtrust/model/OxAuthClient.java @@ -62,7 +62,7 @@ public class OxAuthClient extends Entry implements Serializable { private List oxAuthRedirectURIs; @AttributeName(name = "oxAuthPostLogoutRedirectURI") - private String oxAuthPostLogoutRedirectURIs; + private List oxAuthPostLogoutRedirectURIs; @AttributeName(name = "oxAuthScope") private List oxAuthScopes; @@ -301,11 +301,11 @@ public void setOxAuthRedirectURIs(List oxAuthRedirectURIs) { this.oxAuthRedirectURIs = oxAuthRedirectURIs; } - public String getOxAuthPostLogoutRedirectURIs() { + public List getOxAuthPostLogoutRedirectURIs() { return oxAuthPostLogoutRedirectURIs; } - public void setOxAuthPostLogoutRedirectURIs(String oxAuthPostLogoutRedirectURIs) { + public void setOxAuthPostLogoutRedirectURIs(List oxAuthPostLogoutRedirectURIs) { this.oxAuthPostLogoutRedirectURIs = oxAuthPostLogoutRedirectURIs; } diff --git a/server/src/main/webapp/WEB-INF/incl/client/clientForm.xhtml b/server/src/main/webapp/WEB-INF/incl/client/clientForm.xhtml index 3bedca316..3000b7e6e 100644 --- a/server/src/main/webapp/WEB-INF/incl/client/clientForm.xhtml +++ b/server/src/main/webapp/WEB-INF/incl/client/clientForm.xhtml @@ -692,12 +692,41 @@ - - - + + + + + +
+
+ + +
+ + + +
+
+
+
+
+ + +
+
+
diff --git a/server/src/main/webapp/client/addClient.xhtml b/server/src/main/webapp/client/addClient.xhtml index 43b320eea..758e9c381 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}" /> + + +