diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AttrRepoDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AttrRepoDirectoryPanel.java index 32e46a7448..5520b6b036 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AttrRepoDirectoryPanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AttrRepoDirectoryPanel.java @@ -50,7 +50,6 @@ import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.event.Broadcast; import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; 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.markup.html.basic.Label; @@ -217,15 +216,14 @@ protected final class AttrRepoProvider extends DirectoryDataProvider private AttrRepoProvider(final int paginatorRows) { super(paginatorRows); - setSort(Constants.KEY_FIELD_NAME, SortOrder.ASCENDING); comparator = new SortableDataProviderComparator<>(this); } @Override public Iterator iterator(final long first, final long count) { - List result = restClient.list(); - result.sort(comparator); - return result.subList((int) first, (int) first + (int) count).iterator(); + List attrRepos = restClient.list(); + attrRepos.sort(comparator); + return attrRepos.subList((int) first, (int) first + (int) count).iterator(); } @Override diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java index 574279e070..26569be550 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/AuthModuleDirectoryPanel.java @@ -50,7 +50,6 @@ import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.event.Broadcast; import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; 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.markup.html.basic.Label; @@ -221,15 +220,14 @@ protected final class AuthModuleProvider extends DirectoryDataProvider(this); } @Override public Iterator iterator(final long first, final long count) { - List result = restClient.list(); - result.sort(comparator); - return result.subList((int) first, (int) first + (int) count).iterator(); + List authModules = restClient.list(); + authModules.sort(comparator); + return authModules.subList((int) first, (int) first + (int) count).iterator(); } @Override diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.java index 1fdf42769e..2ec1e9ea21 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2IdPEntityDirectoryPanel.java @@ -39,7 +39,6 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.Broadcast; import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; @@ -165,15 +164,14 @@ protected final class SAML2IdPEntityProvider extends DirectoryDataProvider(this); } @Override public Iterator iterator(final long first, final long count) { - List list = restClient.list(); - list.sort(comparator); - return list.subList((int) first, (int) first + (int) count).iterator(); + List idps = restClient.list(); + idps.sort(comparator); + return idps.subList((int) first, (int) first + (int) count).iterator(); } @Override diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.java index 310bfe1423..10f9940912 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SAML2SPEntityDirectoryPanel.java @@ -42,7 +42,6 @@ import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.event.Broadcast; import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; @@ -191,15 +190,14 @@ protected final class SAML2SPEntityProvider extends DirectoryDataProvider(this); } @Override public Iterator iterator(final long first, final long count) { - List list = restClient.list(); - list.sort(comparator); - return list.subList((int) first, (int) first + (int) count).iterator(); + List sps = restClient.list(); + sps.sort(comparator); + return sps.subList((int) first, (int) first + (int) count).iterator(); } @Override diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java index 7379041851..ff65011667 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java @@ -40,6 +40,7 @@ import org.apache.wicket.request.resource.IResource; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @@ -109,11 +110,15 @@ public SyncopeCoreHealthIndicator syncopeCoreHealthIndicator( props.isUseGZIPCompression()); } + @ConditionalOnProperty( + prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true) @Bean public KeymasterStart keymasterStart() { return new KeymasterStart(NetworkService.Type.CONSOLE); } + @ConditionalOnProperty( + prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true) @Bean public KeymasterStop keymasterStop() { return new KeymasterStop(NetworkService.Type.CONSOLE); diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java index b2c8e86035..b017730bbe 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/AnyDataProvider.java @@ -83,7 +83,6 @@ public AnyDataProvider( break; default: - setSort(Constants.KEY_FIELD_NAME, SortOrder.ASCENDING); } this.comparator = new SortableAnyProviderComparator<>(this); diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/MailTemplateDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/MailTemplateDirectoryPanel.java index baa55ed382..51d897be10 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/MailTemplateDirectoryPanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/MailTemplateDirectoryPanel.java @@ -49,7 +49,6 @@ import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; 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; @@ -195,15 +194,14 @@ protected final class MailTemplateProvider extends DirectoryDataProvider(this); } @Override public Iterator iterator(final long first, final long count) { - final List list = restClient.listTemplates(); - list.sort(comparator); - return list.subList((int) first, (int) first + (int) count).iterator(); + List templates = restClient.listTemplates(); + templates.sort(comparator); + return templates.subList((int) first, (int) first + (int) count).iterator(); } @Override diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationDirectoryPanel.java index 6f8e353e4c..a3791f049b 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationDirectoryPanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationDirectoryPanel.java @@ -50,7 +50,6 @@ import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.event.Broadcast; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; 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; @@ -200,16 +199,14 @@ protected class NotificationProvider extends DirectoryDataProvider(this); } @Override public Iterator iterator(final long first, final long count) { - List list = restClient.list(); - list.sort(comparator); - return list.subList((int) first, (int) first + (int) count).iterator(); + List notifications = restClient.list(); + notifications.sort(comparator); + return notifications.subList((int) first, (int) first + (int) count).iterator(); } @Override diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java index 34698af886..e73ae45928 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ImplementationDirectoryPanel.java @@ -43,7 +43,6 @@ import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.event.Broadcast; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; 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.markup.html.WebMarkupContainer; @@ -193,16 +192,14 @@ protected class ImplementationProvider extends DirectoryDataProvider(this); } @Override public Iterator iterator(final long first, final long count) { - List list = restClient.list(type); - list.sort(comparator); - return list.subList((int) first, (int) first + (int) count).iterator(); + List implementations = restClient.list(type); + implementations.sort(comparator); + return implementations.subList((int) first, (int) first + (int) count).iterator(); } @Override diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java index 136cb47d8a..336694843f 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/SchemaTypePanel.java @@ -47,7 +47,6 @@ import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.event.Broadcast; import org.apache.wicket.event.IEvent; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; 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.CompoundPropertyModel; @@ -218,9 +217,7 @@ protected final class SchemaProvider extends DirectoryDataProvider { private SchemaProvider(final int paginatorRows, final SchemaType schemaType) { super(paginatorRows); - this.schemaType = schemaType; - setSort(Constants.KEY_FIELD_NAME, SortOrder.ASCENDING); comparator = new SortableDataProviderComparator<>(this); } @@ -228,7 +225,6 @@ private SchemaProvider(final int paginatorRows, final SchemaType schemaType) { public Iterator iterator(final long first, final long count) { List schemas = restClient.getSchemas(this.schemaType, keyword); schemas.sort(comparator); - return schemas.subList((int) first, (int) first + (int) count).iterator(); } diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java index 6bb4b12232..23061e9caf 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/TaskDirectoryPanel.java @@ -25,14 +25,12 @@ import org.apache.syncope.client.console.panels.MultilevelPanel; import org.apache.syncope.client.console.rest.TaskRestClient; import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; -import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.panels.ModalPanel; import org.apache.syncope.common.lib.to.TaskTO; import org.apache.syncope.common.lib.types.TaskType; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.IEvent; -import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.IModel; @@ -93,8 +91,6 @@ protected abstract class TasksProvider extends DirectoryDataPr public TasksProvider(final int paginatorRows, final TaskType type) { super(paginatorRows); - - setSort(Constants.KEY_FIELD_NAME, SortOrder.ASCENDING); this.type = type; } diff --git a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java index 756e023960..96c0f065f7 100644 --- a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java +++ b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/SyncopeEnduserApplication.java @@ -30,6 +30,7 @@ import org.apache.wicket.request.resource.IResource; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @@ -78,11 +79,15 @@ public SyncopeCoreHealthIndicator syncopeCoreHealthIndicator( props.isUseGZIPCompression()); } + @ConditionalOnProperty( + prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true) @Bean public KeymasterStart keymasterStart() { return new KeymasterStart(NetworkService.Type.ENDUSER); } + @ConditionalOnProperty( + prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true) @Bean public KeymasterStop keymasterStop() { return new KeymasterStop(NetworkService.Type.ENDUSER); diff --git a/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java index f73893c424..f1b873bf34 100644 --- a/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java +++ b/common/idrepo/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java @@ -69,7 +69,7 @@ public interface TaskService extends ExecutableService { * @param key key of task to be read * @param details whether include executions or not, defaults to true * @param type of taskTO - * @return task with matching id + * @return task with matching key */ @GET @Path("{type}/{key}") diff --git a/common/keymaster/client-api/src/main/java/org/apache/syncope/common/keymaster/client/api/KeymasterProperties.java b/common/keymaster/client-api/src/main/java/org/apache/syncope/common/keymaster/client/api/KeymasterProperties.java index 1878ebaa54..c7eedb7c03 100644 --- a/common/keymaster/client-api/src/main/java/org/apache/syncope/common/keymaster/client/api/KeymasterProperties.java +++ b/common/keymaster/client-api/src/main/java/org/apache/syncope/common/keymaster/client/api/KeymasterProperties.java @@ -33,6 +33,8 @@ public class KeymasterProperties { private int maxRetries = 3; + private boolean enableAutoRegistration = true; + public String getAddress() { return address; } @@ -72,4 +74,12 @@ public int getMaxRetries() { public void setMaxRetries(final int maxRetries) { this.maxRetries = maxRetries; } + + public boolean isEnableAutoRegistration() { + return enableAutoRegistration; + } + + public void setEnableAutoRegistration(final boolean enableAutoRegistration) { + this.enableAutoRegistration = enableAutoRegistration; + } } diff --git a/common/keymaster/self/rest-api/pom.xml b/common/keymaster/self/rest-api/pom.xml index 1c3efeffad..bf9ab7ffb6 100644 --- a/common/keymaster/self/rest-api/pom.xml +++ b/common/keymaster/self/rest-api/pom.xml @@ -53,6 +53,21 @@ under the License. + + + org.apache.maven.plugins + maven-javadoc-plugin + true + + + attach-javadocs + + jar + + + + + org.apache.maven.plugins maven-checkstyle-plugin diff --git a/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/ConfParamService.java b/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/ConfParamService.java index 9082ea1f71..5c3b2d37cc 100644 --- a/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/ConfParamService.java +++ b/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/ConfParamService.java @@ -18,6 +18,11 @@ */ package org.apache.syncope.common.keymaster.rest.api.service; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.security.SecurityRequirements; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -35,26 +40,55 @@ /** * REST operations for Self Keymaster's conf params. */ +@Tag(name = "Conf Parameters") +@SecurityRequirements({ + @SecurityRequirement(name = "BasicAuthentication") }) @Path("conf") public interface ConfParamService extends Serializable { + /** + * Returns the full list of defined conf parameters, with values. + * + * @return full list of defined conf parameters, with values + */ @GET @Produces({ MediaType.APPLICATION_JSON }) Map list(); + /** + * Returns the value(s) of the given conf parameter, if defined. + * + * @param key conf parameter key + * @return the value(s) of the given conf parameter, if defined + */ @GET @Path("{key}") @Produces({ MediaType.APPLICATION_JSON }) Response get(@NotNull @PathParam("key") String key); + /** + * Sets the value(s) for the given conf parameter. + * + * @param key conf parameter key + * @param value conf parameter value(s) + */ + @ApiResponses( + @ApiResponse(responseCode = "204", description = "Operation was successful")) @POST @Path("{key}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - Response set(@NotNull @PathParam("key") String key, InputStream value); + void set(@NotNull @PathParam("key") String key, InputStream value); + /** + * Deletes the conf parameter matching the provided key. + * + * @param key conf parameter key + */ + @ApiResponses( + @ApiResponse(responseCode = "204", description = "Operation was successful")) @DELETE @Path("{key}") @Produces({ MediaType.APPLICATION_JSON }) - Response remove(@NotNull @PathParam("key") String key); + void remove(@NotNull @PathParam("key") String key); } diff --git a/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/DomainService.java b/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/DomainService.java index d39d532452..489158e124 100644 --- a/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/DomainService.java +++ b/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/DomainService.java @@ -18,6 +18,13 @@ */ package org.apache.syncope.common.keymaster.rest.api.service; +import io.swagger.v3.oas.annotations.headers.Header; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.security.SecurityRequirements; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -27,51 +34,107 @@ import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import java.io.Serializable; import java.util.List; import org.apache.syncope.common.keymaster.client.api.model.Domain; import org.apache.syncope.common.lib.types.CipherAlgorithm; +import org.apache.syncope.common.rest.api.RESTHeaders; /** * REST operations for Self Keymaster's domains. */ +@Tag(name = "Domains") +@SecurityRequirements({ + @SecurityRequirement(name = "BasicAuthentication") }) @Path("domains") public interface DomainService extends Serializable { + /** + * Returns the list of defined domains. + * + * @return list of defined domains + */ @GET @Produces({ MediaType.APPLICATION_JSON }) List list(); + /** + * Returns the domain matching the given key. + * + * @param key key of the domain to be read + * @return domain matching the given key + */ @GET @Path("{key}") @Produces({ MediaType.APPLICATION_JSON }) Domain read(@NotNull @PathParam("key") String key); + /** + * Creates a new domain. + * + * @param domain domain to be created + * @return Response object featuring Location header of created domain + */ + @ApiResponses( + @ApiResponse(responseCode = "201", + description = "Domain successfully created", headers = { + @Header(name = RESTHeaders.RESOURCE_KEY, schema = + @Schema(type = "string"), + description = "Key of the domin created"), + @Header(name = HttpHeaders.LOCATION, schema = + @Schema(type = "string"), + description = "URL of the domin created") })) @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) Response create(Domain domain); + /** + * Change admin's password for the given domain. + * + * @param key key of domain to be updated + * @param password encoded password value + * @param cipherAlgorithm password cipher algorithm + */ + @ApiResponses( + @ApiResponse(responseCode = "204", description = "Operation was successful")) @POST @Path("{key}/changeAdminPassword") @Produces({ MediaType.APPLICATION_JSON }) - Response changeAdminPassword( + void changeAdminPassword( @NotNull @PathParam("key") String key, @QueryParam("password") String password, @QueryParam("cipherAlgorithm") CipherAlgorithm cipherAlgorithm); + /** + * Adjusts the connection pool to the domain database. + * + * @param key key of domain to be updated + * @param poolMaxActive database pool max size + * @param poolMinIdle database pool max size + */ + @ApiResponses( + @ApiResponse(responseCode = "204", description = "Operation was successful")) @POST @Path("{key}/adjustPoolSize") @Produces({ MediaType.APPLICATION_JSON }) - Response adjustPoolSize( + void adjustPoolSize( @NotNull @PathParam("key") String key, @QueryParam("poolMaxActive") int poolMaxActive, @QueryParam("poolMinIdle") int poolMinIdle); + /** + * Deletes the domain matching the provided key. + * + * @param key key of domain to be deleted + */ + @ApiResponses( + @ApiResponse(responseCode = "204", description = "Operation was successful")) @DELETE @Path("{key}") @Produces({ MediaType.APPLICATION_JSON }) - Response delete(@NotNull @PathParam("key") String key); + void delete(@NotNull @PathParam("key") String key); } diff --git a/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/NetworkServiceService.java b/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/NetworkServiceService.java index 84ef18dd90..2a52f8a55e 100644 --- a/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/NetworkServiceService.java +++ b/common/keymaster/self/rest-api/src/main/java/org/apache/syncope/common/keymaster/rest/api/service/NetworkServiceService.java @@ -18,6 +18,11 @@ */ package org.apache.syncope.common.keymaster.rest.api.service; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.security.SecurityRequirements; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -27,7 +32,6 @@ import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; import java.io.Serializable; import java.util.List; import org.apache.syncope.common.keymaster.client.api.model.NetworkService; @@ -35,6 +39,9 @@ /** * REST operations for Self Keymaster's service discovery. */ +@Tag(name = "Network Services") +@SecurityRequirements({ + @SecurityRequirement(name = "BasicAuthentication") }) @Path("networkServices") public interface NetworkServiceService extends Serializable { @@ -44,20 +51,40 @@ enum Action { } + /** + * Returns the list of registered services. + * + * @param serviceType service type + * @return list of registered services + */ @GET @Path("{serviceType}") @Produces({ MediaType.APPLICATION_JSON }) List list(@NotNull @PathParam("serviceType") NetworkService.Type serviceType); + /** + * Returns the service instance to invoke, for the given type. + * + * @param serviceType service type + * @return service instance to invoke, for the given type + */ @GET @Path("{serviceType}/get") @Produces({ MediaType.APPLICATION_JSON }) NetworkService get(@NotNull @PathParam("serviceType") NetworkService.Type serviceType); + /** + * (Un)registers the given service. + * + * @param networkService service instance + * @param action action to perform on the given service + */ + @ApiResponses( + @ApiResponse(responseCode = "204", description = "Operation was successful")) @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - Response action( + void action( @NotNull NetworkService networkService, @QueryParam("action") Action action); } diff --git a/core/am/rest-cxf/pom.xml b/core/am/rest-cxf/pom.xml index d029b40730..2a82237c3b 100644 --- a/core/am/rest-cxf/pom.xml +++ b/core/am/rest-cxf/pom.xml @@ -43,13 +43,6 @@ under the License. jakarta.servlet-api provided - - - org.apache.syncope.common.am - syncope-common-am-rest-api - ${project.version} - javadoc - org.apache.syncope.core.idrepo @@ -66,6 +59,12 @@ under the License. syncope-common-am-rest-api ${project.version} + + org.apache.syncope.common.am + syncope-common-am-rest-api + ${project.version} + javadoc + diff --git a/core/idm/rest-cxf/pom.xml b/core/idm/rest-cxf/pom.xml index e0247aea9e..79ceb8b068 100644 --- a/core/idm/rest-cxf/pom.xml +++ b/core/idm/rest-cxf/pom.xml @@ -43,13 +43,6 @@ under the License. jakarta.servlet-api provided - - - org.apache.syncope.common.idm - syncope-common-idm-rest-api - ${project.version} - javadoc - org.apache.syncope.core.idrepo @@ -66,6 +59,12 @@ under the License. syncope-common-idm-rest-api ${project.version} + + org.apache.syncope.common.idm + syncope-common-idm-rest-api + ${project.version} + javadoc + diff --git a/core/idrepo/rest-cxf/pom.xml b/core/idrepo/rest-cxf/pom.xml index f8f631b815..898e165cf9 100644 --- a/core/idrepo/rest-cxf/pom.xml +++ b/core/idrepo/rest-cxf/pom.xml @@ -86,12 +86,6 @@ under the License. org.apache.cxf cxf-rt-rs-client - - org.apache.syncope.common.idrepo - syncope-common-idrepo-rest-api - ${project.version} - javadoc - org.apache.syncope.core.idrepo @@ -103,6 +97,12 @@ under the License. syncope-common-idrepo-rest-api ${project.version} + + org.apache.syncope.common.idrepo + syncope-common-idrepo-rest-api + ${project.version} + javadoc + diff --git a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/IdRepoRESTCXFContext.java b/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/IdRepoRESTCXFContext.java index 3dad870312..93779512e4 100644 --- a/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/IdRepoRESTCXFContext.java +++ b/core/idrepo/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/IdRepoRESTCXFContext.java @@ -280,18 +280,9 @@ public OpenApiFeature openapiFeature(final OpenApiCustomizer openApiCustomizer, openapiFeature.setScan(false); openapiFeature.setResourcePackages(Set.of("org.apache.syncope.common.rest.api.service")); openapiFeature.setCustomizer(openApiCustomizer); - - Map securityDefinitions = new HashMap<>(); - SecurityScheme basicAuth = new SecurityScheme(); - basicAuth.setType(SecurityScheme.Type.HTTP); - basicAuth.setScheme("basic"); - securityDefinitions.put("BasicAuthentication", basicAuth); - SecurityScheme bearer = new SecurityScheme(); - bearer.setType(SecurityScheme.Type.HTTP); - bearer.setScheme("bearer"); - bearer.setBearerFormat("JWT"); - securityDefinitions.put("Bearer", bearer); - openapiFeature.setSecurityDefinitions(securityDefinitions); + openapiFeature.setSecurityDefinitions(Map.of( + "BasicAuthentication", new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("basic"), + "Bearer", new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT"))); return openapiFeature; } diff --git a/core/self-keymaster-starter/pom.xml b/core/self-keymaster-starter/pom.xml index e96d48ecf9..95f9ed7320 100644 --- a/core/self-keymaster-starter/pom.xml +++ b/core/self-keymaster-starter/pom.xml @@ -47,7 +47,13 @@ under the License. org.apache.syncope.common.keymaster.self syncope-common-keymaster-self-rest-api - ${project.version} + ${project.version} + + + org.apache.syncope.common.keymaster.self + syncope-common-keymaster-self-rest-api + ${project.version} + javadoc diff --git a/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/ConfParamServiceImpl.java b/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/ConfParamServiceImpl.java index cfc9dcbbdb..7e8b0bfa2a 100644 --- a/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/ConfParamServiceImpl.java +++ b/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/ConfParamServiceImpl.java @@ -56,7 +56,7 @@ public Response get(final String key) { } @Override - public Response set(final String key, final InputStream value) { + public void set(final String key, final InputStream value) { JsonNode valueNode = null; try { valueNode = MAPPER.readTree(value); @@ -65,12 +65,10 @@ public Response set(final String key, final InputStream value) { } logic.set(key, valueNode); - return Response.noContent().build(); } @Override - public Response remove(final String key) { + public void remove(final String key) { logic.remove(key); - return Response.noContent().build(); } } diff --git a/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/DomainServiceImpl.java b/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/DomainServiceImpl.java index 40beaecf5e..ec94bca8d3 100644 --- a/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/DomainServiceImpl.java +++ b/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/DomainServiceImpl.java @@ -64,22 +64,17 @@ public Response create(final Domain domain) { } @Override - public Response changeAdminPassword( - final String key, final String password, final CipherAlgorithm cipherAlgorithm) { - + public void changeAdminPassword(final String key, final String password, final CipherAlgorithm cipherAlgorithm) { logic.changeAdminPassword(key, password, cipherAlgorithm); - return Response.noContent().build(); } @Override - public Response adjustPoolSize(final String key, final int poolMaxActive, final int poolMinIdle) { + public void adjustPoolSize(final String key, final int poolMaxActive, final int poolMinIdle) { logic.adjustPoolSize(key, poolMaxActive, poolMinIdle); - return Response.noContent().build(); } @Override - public Response delete(final String key) { + public void delete(final String key) { logic.delete(key); - return Response.noContent().build(); } } diff --git a/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/NetworkServiceServiceImpl.java b/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/NetworkServiceServiceImpl.java index 2725d79f76..32b5357730 100644 --- a/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/NetworkServiceServiceImpl.java +++ b/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/keymaster/rest/cxf/service/NetworkServiceServiceImpl.java @@ -18,7 +18,6 @@ */ package org.apache.syncope.core.keymaster.rest.cxf.service; -import jakarta.ws.rs.core.Response; import java.util.List; import org.apache.syncope.common.keymaster.client.api.model.NetworkService; import org.apache.syncope.common.keymaster.rest.api.service.NetworkServiceService; @@ -47,12 +46,11 @@ public NetworkService get(final NetworkService.Type serviceType) { } @Override - public Response action(final NetworkService networkService, final Action action) { + public void action(final NetworkService networkService, final Action action) { if (action == Action.unregister) { logic.unregister(networkService); } else { logic.register(networkService); } - return Response.noContent().build(); } } diff --git a/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/starter/SelfKeymasterContext.java b/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/starter/SelfKeymasterContext.java index 0cf4311e58..7e5d6da469 100644 --- a/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/starter/SelfKeymasterContext.java +++ b/core/self-keymaster-starter/src/main/java/org/apache/syncope/core/starter/SelfKeymasterContext.java @@ -19,12 +19,21 @@ package org.apache.syncope.core.starter; import com.fasterxml.jackson.jakarta.rs.json.JacksonJsonProvider; +import io.swagger.v3.oas.integration.api.OpenAPIConfiguration; +import io.swagger.v3.oas.models.security.SecurityScheme; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; import org.apache.cxf.Bus; import org.apache.cxf.endpoint.Server; +import org.apache.cxf.jaxrs.ext.MessageContext; +import org.apache.cxf.jaxrs.model.doc.JavaDocProvider; +import org.apache.cxf.jaxrs.openapi.OpenApiCustomizer; +import org.apache.cxf.jaxrs.openapi.OpenApiFeature; import org.apache.cxf.jaxrs.spring.JAXRSServerFactoryBeanDefinitionParser.SpringJAXRSServerFactoryBean; +import org.apache.cxf.jaxrs.utils.JAXRSUtils; import org.apache.cxf.jaxrs.validation.JAXRSBeanValidationInInterceptor; import org.apache.cxf.transport.common.gzip.GZIPInInterceptor; import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor; @@ -56,6 +65,7 @@ import org.apache.syncope.core.persistence.jpa.dao.JPANetworkServiceDAO; import org.apache.syncope.core.persistence.jpa.entity.JPASelfKeymasterEntityFactory; import org.apache.syncope.core.provisioning.api.UserProvisioningManager; +import org.apache.syncope.core.rest.cxf.JavaDocUtils; import org.apache.syncope.core.rest.cxf.RestServiceExceptionMapper; import org.apache.syncope.core.spring.security.AuthDataAccessor; import org.apache.syncope.core.spring.security.DefaultCredentialChecker; @@ -63,6 +73,8 @@ import org.apache.syncope.core.spring.security.UsernamePasswordAuthenticationProvider; import org.apache.syncope.core.spring.security.WebSecurityContext; import org.apache.syncope.core.starter.SelfKeymasterContext.SelfKeymasterCondition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionOutcome; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; @@ -71,6 +83,7 @@ import org.springframework.context.annotation.ConditionContext; import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; import org.springframework.core.type.AnnotatedTypeMetadata; @EnableConfigurationProperties(KeymasterProperties.class) @@ -79,6 +92,8 @@ @Conditional(SelfKeymasterCondition.class) public class SelfKeymasterContext { + private static final Logger LOG = LoggerFactory.getLogger(SelfKeymasterContext.class); + private static final Pattern HTTP = Pattern.compile("^http.+"); static class SelfKeymasterCondition extends SpringBootCondition { @@ -102,7 +117,8 @@ public Server selfKeymasterContainer( final GZIPOutInterceptor gzipOutInterceptor, final JAXRSBeanValidationInInterceptor validationInInterceptor, final RestServiceExceptionMapper restServiceExceptionMapper, - final Bus bus) { + final Bus bus, + final Environment env) { SpringJAXRSServerFactoryBean selfKeymasterContainer = new SpringJAXRSServerFactoryBean(); selfKeymasterContainer.setBus(bus); @@ -119,6 +135,54 @@ public Server selfKeymasterContainer( selfKeymasterContainer.setProviders(List.of(restServiceExceptionMapper, jsonProvider)); + // OpenAPI + JavaDocProvider javaDocProvider = JavaDocUtils.getJavaDocURLs(). + map(JavaDocProvider::new). + orElseGet(() -> JavaDocUtils.getJavaDocPaths(env). + map(javaDocPaths -> { + try { + return new JavaDocProvider(javaDocPaths); + } catch (Exception e) { + LOG.error("Could not set javadoc paths from {}", List.of(javaDocPaths), e); + return null; + } + }). + orElse(null)); + OpenApiCustomizer openApiCustomizer = new OpenApiCustomizer() { + + @Override + public OpenAPIConfiguration customize(final OpenAPIConfiguration configuration) { + super.customize(configuration); + + MessageContext ctx = JAXRSUtils.createContextValue( + JAXRSUtils.getCurrentMessage(), null, MessageContext.class); + + String url = StringUtils.substringBeforeLast(ctx.getUriInfo().getRequestUri().getRawPath(), "/"); + configuration.getOpenAPI().setServers(List.of(new io.swagger.v3.oas.models.servers.Server().url(url))); + + return configuration; + } + }; + openApiCustomizer.setDynamicBasePath(false); + openApiCustomizer.setReplaceTags(false); + openApiCustomizer.setJavadocProvider(javaDocProvider); + + String version = env.getProperty("version"); + OpenApiFeature openapiFeature = new OpenApiFeature(); + openapiFeature.setUseContextBasedConfig(true); + openapiFeature.setTitle("Apache Syncope Self Keymaster"); + openapiFeature.setVersion(version); + openapiFeature.setDescription("Apache Syncope Self Keymaster" + version); + openapiFeature.setContactName("The Apache Syncope community"); + openapiFeature.setContactEmail("dev@syncope.apache.org"); + openapiFeature.setContactUrl("https://syncope.apache.org"); + openapiFeature.setScan(false); + openapiFeature.setResourcePackages(Set.of("org.apache.syncope.common.keymaster.rest.api.service")); + openapiFeature.setSecurityDefinitions( + Map.of("BasicAuthentication", new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("basic"))); + openapiFeature.setCustomizer(openApiCustomizer); + selfKeymasterContainer.setFeatures(List.of(openapiFeature)); + return selfKeymasterContainer.create(); } diff --git a/core/starter/src/main/resources/META-INF/resources/index.html b/core/starter/src/main/resources/META-INF/resources/index.html index c804db7082..4b4b9684d8 100644 --- a/core/starter/src/main/resources/META-INF/resources/index.html +++ b/core/starter/src/main/resources/META-INF/resources/index.html @@ -63,6 +63,10 @@ urls: [{ url: window.location.href.substring(0, window.location.href.lastIndexOf('/')) + "/rest/openapi.json", name: "Apache Syncope" + }, + { + url: window.location.href.substring(0, window.location.href.lastIndexOf('/')) + "/rest/keymaster/openapi.json", + name: "Apache Syncope Self Keymaster" }], docExpansion: 'none', displayOperationId: false, diff --git a/sra/src/main/java/org/apache/syncope/sra/SyncopeSRAApplication.java b/sra/src/main/java/org/apache/syncope/sra/SyncopeSRAApplication.java index 0714783c57..4b711f434c 100644 --- a/sra/src/main/java/org/apache/syncope/sra/SyncopeSRAApplication.java +++ b/sra/src/main/java/org/apache/syncope/sra/SyncopeSRAApplication.java @@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.cache.CacheManager; @@ -60,7 +61,7 @@ public LogoutRouteMatcher logoutRouteMatcher() { public PublicRouteMatcher publicRouteMatcher() { return new PublicRouteMatcher(); } - + @Bean public CsrfRouteMatcher csrfRouteMatcher(final PublicRouteMatcher publicRouteMatcher) { return new CsrfRouteMatcher(publicRouteMatcher); @@ -69,8 +70,8 @@ public CsrfRouteMatcher csrfRouteMatcher(final PublicRouteMatcher publicRouteMat @ConditionalOnMissingBean @Bean public RouteProvider routeProvider(final ConfigurableApplicationContext ctx, - final ServiceOps serviceOps, - final SRAProperties props) { + final ServiceOps serviceOps, + final SRAProperties props) { return new RouteProvider( serviceOps, ctx, @@ -94,7 +95,7 @@ public SRASessions sraSessionsActuatorEndpoint(final CacheManager cacheManager) @ConditionalOnMissingBean @Bean public SyncopeCoreHealthIndicator syncopeCoreHealthIndicator(final ServiceOps serviceOps, - final SRAProperties props) { + final SRAProperties props) { return new SyncopeCoreHealthIndicator( serviceOps, props.getAnonymousUser(), @@ -108,11 +109,15 @@ public SyncopeSRAInfoContributor syncopeSRAInfoContributor() { return new SyncopeSRAInfoContributor(); } + @ConditionalOnProperty( + prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true) @Bean public KeymasterStart keymasterStart() { return new KeymasterStart(NetworkService.Type.SRA); } + @ConditionalOnProperty( + prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true) @Bean public KeymasterStop keymasterStop() { return new KeymasterStop(NetworkService.Type.SRA); @@ -120,8 +125,8 @@ public KeymasterStop keymasterStop() { @Bean public WebExceptionHandler syncopeSRAWebExceptionHandler( - @Qualifier("routeProvider") final RouteProvider routeProvider, - final SRAProperties props) { + @Qualifier("routeProvider") final RouteProvider routeProvider, + final SRAProperties props) { return new SyncopeSRAWebExceptionHandler(routeProvider, props); } } diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/WAContext.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/WAContext.java index 8459f528a6..3042232d1c 100644 --- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/WAContext.java +++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/WAContext.java @@ -95,6 +95,7 @@ import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; @@ -391,11 +392,15 @@ public UserDetailsService actuatorUserDetailsService(final WAProperties waProper return new InMemoryUserDetailsManager(user); } + @ConditionalOnProperty( + prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true) @Bean public KeymasterStart keymasterStart() { return new KeymasterStart(NetworkService.Type.WA); } + @ConditionalOnProperty( + prefix = "keymaster", name = "enableAutoRegistration", havingValue = "true", matchIfMissing = true) @Bean public KeymasterStop keymasterStop() { return new KeymasterStop(NetworkService.Type.WA);