Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .github/workflows/fit_WA_Multitenancy.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.List;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.panels.BeanPanel;
import org.apache.syncope.client.console.rest.AuthProfileRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.JsonEditorPanel;
Expand Down Expand Up @@ -104,7 +105,7 @@ protected class ConsentAttributes extends WizardStep {
String attributes = "{}";
try {
attributes = authProfileRestClient.readConsentAttributes(
serviceOps.get(NetworkService.Type.WA),
serviceOps.get(NetworkService.Type.WA, SyncopeConsoleSession.get().getDomain()),
consentDecision.getPrincipal(),
consentDecision.getId());
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public SRA(final PageParameters parameters) {
body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
body.setOutputMarkupId(true);

List<NetworkService> instances = serviceOps.list(NetworkService.Type.SRA);
List<NetworkService> instances = serviceOps.list(
NetworkService.Type.SRA, SyncopeConsoleSession.get().getDomain());

AjaxLink<?> push = new AjaxLink<>("push") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ public WA(final PageParameters parameters) {
body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
body.setOutputMarkupId(true);

List<NetworkService> instances = serviceOps.list(NetworkService.Type.WA);
List<NetworkService> instances = serviceOps.list(
NetworkService.Type.WA, SyncopeConsoleSession.get().getDomain());

modal = new BaseModal<>("push-modal");
modal.setWindowClosedCallback(target -> modal.show(false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.List;
import java.util.stream.Collectors;
import org.apache.syncope.client.enduser.SyncopeEnduserSession;
import org.apache.syncope.client.enduser.rest.AuthProfileRestClient;
import org.apache.syncope.client.ui.commons.Constants;
import org.apache.syncope.client.ui.commons.annotations.AMPage;
Expand Down Expand Up @@ -237,7 +238,7 @@ public void populateItem(final Item<WAConsentDecision> item) {
String attributes = "{}";
try {
attributes = restClient.readConsentAttributes(
serviceOps.get(NetworkService.Type.WA),
serviceOps.get(NetworkService.Type.WA, SyncopeEnduserSession.get().getDomain()),
item.getModelObject().getPrincipal(),
item.getModelObject().getId());
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ public SyncopeCoreHealthIndicator syncopeCoreHealthIndicator(
prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true)
@Bean
public KeymasterStart keymasterStart() {
return new KeymasterStart(NetworkService.Type.CONSOLE);
return new KeymasterStart.Builder(NetworkService.Type.CONSOLE).build();
}

@ConditionalOnProperty(
prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true)
@Bean
public KeymasterStop keymasterStop() {
return new KeymasterStop(NetworkService.Type.CONSOLE);
return new KeymasterStop.Builder(NetworkService.Type.CONSOLE).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.List;
import java.util.stream.Collectors;
import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.panels.LogsPanel;
import org.apache.syncope.client.console.rest.LoggerConf;
import org.apache.syncope.client.console.rest.LoggerConfOp;
Expand Down Expand Up @@ -123,7 +124,8 @@ public Panel getPanel(final String panelId) {
});
}

List<NetworkService> waInstances = serviceOps.list(NetworkService.Type.WA);
List<NetworkService> waInstances = serviceOps.list(
NetworkService.Type.WA, SyncopeConsoleSession.get().getDomain());
if (!waInstances.isEmpty()) {
tabs.add(new AbstractTab(Model.of(NetworkService.Type.WA.name())) {

Expand All @@ -136,7 +138,8 @@ public Panel getPanel(final String panelId) {
});
}

List<NetworkService> sraInstances = serviceOps.list(NetworkService.Type.SRA);
List<NetworkService> sraInstances = serviceOps.list(
NetworkService.Type.SRA, SyncopeConsoleSession.get().getDomain());
if (!sraInstances.isEmpty()) {
tabs.add(new AbstractTab(Model.of(NetworkService.Type.SRA.name())) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.StringResourceModel;
import org.apache.wicket.spring.injection.annot.SpringBean;

Expand All @@ -58,12 +59,10 @@ public NetworkServiceDirectoryPanel(
final NetworkService.Type type,
final SyncopeRestClient syncopeRestClient,
final PageReference pageRef) {

super(id, syncopeRestClient, pageRef, true);
this.type = type;

NetworkService service = new NetworkService();
service.setType(type);

disableCheckBoxes();

modal.size(Modal.Size.Large);
Expand All @@ -80,6 +79,10 @@ protected List<IColumn<NetworkService, String>> getColumns() {

columns.add(new PropertyColumn<>(new StringResourceModel("address", this), "address", "address"));

if (type == NetworkService.Type.SRA || type == NetworkService.Type.WA) {
columns.add(new PropertyColumn<>(new StringResourceModel("domain", this), "domain", "domain"));
}

return columns;
}

Expand Down Expand Up @@ -145,15 +148,7 @@ public long size() {

@Override
public IModel<NetworkService> model(final NetworkService service) {
return new IModel<>() {

private static final long serialVersionUID = 999513782683391483L;

@Override
public NetworkService getObject() {
return service;
}
};
return Model.of(service);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
any.edit=Edit implementation ${key}
any.new=New ${type} implementation
address=Address
domain=Domain
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
any.edit=Modifica implementazione ${key}
any.new=Nuova implementazione di ${type}
address=Indirizzo
domain=Dominio
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
any.edit=\u5c0e\u5165 ${key} \u3092\u7de8\u96c6
any.new=\u65b0\u3057\u3044 ${type} \u5c0e\u5165
address=\u30a2\u30c9\u30ec\u30b9
domain=Domain
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
any.edit=Edit implementation ${key}
any.new=New ${type} implementation
address=Address
domain=Domain
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
any.edit=Edit implementation ${key}
any.new=New ${type} implementation
address=Address
domain=Domain
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ public SyncopeCoreHealthIndicator syncopeCoreHealthIndicator(
prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true)
@Bean
public KeymasterStart keymasterStart() {
return new KeymasterStart(NetworkService.Type.ENDUSER);
return new KeymasterStart.Builder(NetworkService.Type.ENDUSER).build();
}

@ConditionalOnProperty(
prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true)
@Bean
public KeymasterStop keymasterStop() {
return new KeymasterStop(NetworkService.Type.ENDUSER);
return new KeymasterStop.Builder(NetworkService.Type.ENDUSER).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,22 @@ public interface ServiceOps {

List<NetworkService> list(NetworkService.Type serviceType);

List<NetworkService> list(NetworkService.Type serviceType, String domain);

/**
* Returns the service instance to invoke, for the given type.
*
* @param serviceType service type
* @return service instance to invoke, for the given type
*/
NetworkService get(NetworkService.Type serviceType);

/**
* Returns the service instance to invoke, for the given type and domain.
*
* @param serviceType service type
* @param domain domain
* @return service instance to invoke, for the given type and domain
*/
NetworkService get(NetworkService.Type serviceType, String domain);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public enum Type {

private String address;

private String domain;

public Type getType() {
return type;
}
Expand All @@ -55,11 +57,20 @@ public void setAddress(final String address) {
this.address = address;
}

public String getDomain() {
return domain;
}

public void setDomain(final String domain) {
this.domain = domain;
}

@Override
public int hashCode() {
return new HashCodeBuilder().
append(type).
append(address).
append(domain).
build();
}

Expand All @@ -78,6 +89,7 @@ public boolean equals(final Object obj) {
return new EqualsBuilder().
append(type, other.type).
append(address, other.address).
append(domain, other.domain).
build();
}

Expand All @@ -86,6 +98,7 @@ public String toString() {
return "NetworkService{"
+ "type=" + type
+ ", address=" + address
+ ", domain=" + domain
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,19 @@

public class KeymasterStart extends KeymasterStartStop implements ApplicationListener<ContextRefreshedEvent> {

public KeymasterStart(final NetworkService.Type networkServiceType) {
public static class Builder extends KeymasterStartStop.Builder<KeymasterStart, Builder> {

public Builder(final NetworkService.Type networkServiceType) {
super(networkServiceType);
}

@Override
protected KeymasterStart newInstance(final NetworkService.Type networkServiceType) {
return new KeymasterStart(networkServiceType);
}
}

protected KeymasterStart(final NetworkService.Type networkServiceType) {
super(networkServiceType);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,50 @@

abstract class KeymasterStartStop {

protected abstract static class Builder<S extends KeymasterStartStop, B extends Builder<S, B>> {

protected final S instance;

Builder(final NetworkService.Type networkServiceType) {
instance = newInstance(networkServiceType);
}

protected abstract S newInstance(NetworkService.Type networkServiceType);

@SuppressWarnings("unchecked")
public B domain(final String domain) {
instance.setDomain(domain);
return (B) this;
}

public S build() {
return instance;
}
}

@Autowired
protected ServiceOps serviceOps;

protected final NetworkService.Type networkServiceType;

private String domain;

@Value("${service.discovery.address}")
private String address;

protected KeymasterStartStop(final NetworkService.Type networkServiceType) {
this.networkServiceType = networkServiceType;
}

@Value("${service.discovery.address}")
private String address;
protected void setDomain(final String domain) {
this.domain = domain;
}

protected NetworkService getNetworkService() {
NetworkService ns = new NetworkService();
ns.setType(networkServiceType);
ns.setAddress(address);
ns.setDomain(domain);
return ns;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,19 @@

public class KeymasterStop extends KeymasterStartStop implements ApplicationListener<ContextClosedEvent> {

public KeymasterStop(final NetworkService.Type networkServiceType) {
public static class Builder extends KeymasterStartStop.Builder<KeymasterStop, Builder> {

public Builder(final NetworkService.Type networkServiceType) {
super(networkServiceType);
}

@Override
protected KeymasterStop newInstance(final NetworkService.Type networkServiceType) {
return new KeymasterStop(networkServiceType);
}
}

protected KeymasterStop(final NetworkService.Type networkServiceType) {
super(networkServiceType);
}

Expand Down
Loading
Loading