Skip to content

Commit

Permalink
[SCIM-29] adding configuration parameter to skip attribute request wh…
Browse files Browse the repository at this point in the history
…ile searching (#82)
  • Loading branch information
andrea-patricelli authored Aug 8, 2024
1 parent a3f5cf2 commit 8003bd1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ public class SCIMConnectorConfiguration extends AbstractConfiguration implements

private boolean followHttpRedirects = false;

@ConfigurationProperty(order = 1, displayMessageKey = "baseAddress.display", helpMessageKey = "baseAddress.help",
private boolean requestAttributesOnSearch = true;

@ConfigurationProperty(order = 1,
displayMessageKey = "baseAddress.display",
helpMessageKey = "baseAddress.help",
required = true)
public String getBaseAddress() {
if (StringUtil.isNotBlank(baseAddress) && baseAddress.charAt(baseAddress.length() - 1) != '/') {
Expand Down Expand Up @@ -375,6 +379,17 @@ public void setFollowHttpRedirects(final boolean followHttpRedirects) {
this.followHttpRedirects = followHttpRedirects;
}

@ConfigurationProperty(displayMessageKey = "requestAttributesOnSearch.display",
helpMessageKey = "requestAttributesOnSearch.help",
order = 27)
public boolean getRequestAttributesOnSearch() {
return requestAttributesOnSearch;
}

public void setRequestAttributesOnSearch(final boolean requestAttributesOnSearch) {
this.requestAttributesOnSearch = requestAttributesOnSearch;
}

@Override
public void validate() {
if (StringUtil.isBlank(baseAddress)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ public boolean testService() {
@Override
public List<UT> getAllUsers(final Set<String> attributesToGet) {
Map<String, String> params = new HashMap<>();
if (!attributesToGet.isEmpty()) {
if (!attributesToGet.isEmpty() && config.getRequestAttributesOnSearch()) {
params.put("attributes", SCIMUtils.cleanAttributesToGet(attributesToGet, config.getCustomAttributesJSON(),
SCIMv2Attribute.class));
}
Expand All @@ -587,7 +587,7 @@ public List<UT> getAllUsers(final Set<String> attributesToGet) {
public List<UT> getAllUsers(final String filterQuery, final Set<String> attributesToGet) {
Map<String, String> params = new HashMap<>();
params.put("filter", filterQuery);
if (!attributesToGet.isEmpty()) {
if (!attributesToGet.isEmpty() && config.getRequestAttributesOnSearch()) {
params.put("attributes", SCIMUtils.cleanAttributesToGet(attributesToGet, config.getCustomAttributesJSON(),
SCIMv2Attribute.class));
}
Expand All @@ -609,7 +609,7 @@ public PagedResults<UT> getAllUsers(final Integer startIndex, final Integer coun
if (count != null) {
params.put("count", String.valueOf(count));
}
if (!attributesToGet.isEmpty()) {
if (!attributesToGet.isEmpty() && config.getRequestAttributesOnSearch()) {
params.put("attributes", SCIMUtils.cleanAttributesToGet(attributesToGet, config.getCustomAttributesJSON(),
SCIMv2Attribute.class));
}
Expand All @@ -633,8 +633,12 @@ public PagedResults<UT> getAllUsers(final String filterQuery, final Integer star
params.put("count", String.valueOf(count));
}
params.put("filter", filterQuery);
params.put("attributes", SCIMUtils.cleanAttributesToGet(attributesToGet, config.getCustomAttributesJSON(),
SCIMv2Attribute.class));
if (!attributesToGet.isEmpty() && config.getRequestAttributesOnSearch()) {
params.put("attributes",
SCIMUtils.cleanAttributesToGet(attributesToGet,
config.getCustomAttributesJSON(),
SCIMv2Attribute.class));
}
WebClient webClient = getWebclient("Users", params);
return doGetAllUsers(webClient);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ manageComplexEntitlements.display=Manage complex entitlements
manageComplexEntitlements.help=Whether to manage entitlements other than the default one (1.1 only supports the default entitlement)
scimProvider.display=SCIM Server provider
scimProvider.help=Specifies which provider the connector is connecting to, use STANDARD if the provider fully supports the SCIM standard, otherwise set one among: SALESFORCE, WSO2, AWS
proxyServerType.display=Proxy Server Type
proxyServerType.help=Specifies the type of the proxy server to use (if any) to access to the SCIM server, allowed values are HTTP and SOCKS
proxyServerHost.display=Proxy Server Host
proxyServerHost.help=Specifies proxy host to connect to reach SCIM server
proxyServerPort.display=Proxy Server Port
Expand All @@ -69,4 +71,5 @@ proxyServerPassword.display=Proxy Server Password
proxyServerPassword.help=Specifies password to authenticate on proxy
followHttpRedirects.display=Follow HTTP redirects
followHttpRedirects.help=Specifies whether the HTTP client should follow or not HTTP redirects like the 302 Found

requestAttributesOnSearch.display=Request attributes while searching
requestAttributesOnSearch.help=Specifies whether to request 'attributes' while searching. Defaults to true, but may be set to false, to comply with some providers like Egnyte.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ manageComplexEntitlements.display=Gestisci gli entitlement complessi
manageComplexEntitlements.help=Gestisci gli entitlement con tipi diversi da quello di default (nella versione 1.1 è supportato solo l'entitlement di default)
scimProvider.display=SCIM Server provider
scimProvider.help=Specifica il provider del server SCIM al quale si sta collegando il connettore, lasciare il valore di default STANDARD se il provider supporta completamente le specifiche SCIM, altrimenti impostare uno dei valori: SALESFORCE, WSO2, AWS
proxyServerType.display=Tipo Proxy Server
proxyServerType.help=Specifica il tipo di server proxy (se presente) al quale connettersi, i valori consentiti sono HTTP and SOCKS
proxyServerHost.display=Host Server Proxy
proxyServerHost.help=Specifica l'host del proxy da usare per connettersi al server SCIM
proxyServerPort.display=Porta Server Proxy
Expand All @@ -69,3 +71,5 @@ proxyServerPassword.display=Password Server Proxy
proxyServerPassword.help=Specifica la password per autenticarsi al proxy
followHttpRedirects.display=Follow HTTP redirects
followHttpRedirects.help=Specifica se l'HTTP client deve seguire o meno le redirect HTTP, ad es. 302 Found
requestAttributesOnSearch.display=Request attributes while searching
requestAttributesOnSearch.help=Specifica se richiedere gli attributi tramite parametro 'attributes' durante la ricerca. Il valore di default \u00e8 true, ma pu\u00f2 essere settato a false, se necessario, per integrarsi con provider come Egnyte.

0 comments on commit 8003bd1

Please sign in to comment.