Skip to content

Commit

Permalink
making rabbitmq optional for gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
marwanehcine authored and emmdurin committed Oct 24, 2023
1 parent 8180e6a commit 6bd2da2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
import org.geoserver.cloud.gateway.filter.RouteProfileGatewayFilterFactory;
import org.geoserver.cloud.gateway.filter.StripBasePathGatewayFilterFactory;
import org.geoserver.cloud.gateway.predicate.RegExpQueryRoutePredicateFactory;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.gateway.config.GatewayAutoConfiguration;
import org.springframework.cloud.gateway.filter.GlobalFilter;
Expand Down Expand Up @@ -65,4 +68,8 @@ public class FiltersAutoConfiguration {
return new StripBasePathGatewayFilterFactory();
}

@ConditionalOnProperty(name = "enableRabbitmqEvents", havingValue = "true", matchIfMissing = false)
public @Bean HealthIndicator rabbitHealthIndicator() {
return () -> Health.up().withDetail("version", "mock").build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.amqp.core.Queue;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.gateway.config.GatewayAutoConfiguration;
import org.springframework.context.annotation.*;

@Profile("!test && !it")
@Configuration(proxyBeanMethods = false)
@AutoConfigureAfter(GatewayAutoConfiguration.class)
@ImportResource({ "classpath:rabbit-listener-context.xml", "classpath:rabbit-sender-context.xml" })
@ConditionalOnExpression("${georchestra.gateway.security.enableRabbitmqEvents:true}")
@ConditionalOnProperty(name = "enableRabbitmqEvents", havingValue = "true", matchIfMissing = false)
public class RabbitmqEventsAutoConfiguration {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ public class LdapConfigProperties implements Validator {

private boolean createNonExistingUsersInLDAP = true;

private boolean enableRabbitmqEvents = true;

@Valid
private Map<String, Server> ldap = Map.of();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.georchestra.security.model.GeorchestraUser;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.core.Ordered;
import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
Expand Down Expand Up @@ -145,6 +146,8 @@
@Slf4j(topic = "org.georchestra.gateway.security.oauth2")
public class OpenIdConnectUserMapper extends OAuth2UserMapper {

private @Value("${enableRabbitmqEvents:false}") boolean enableRabbitmq;

@Autowired
LdapConfigProperties config;

Expand Down Expand Up @@ -195,7 +198,7 @@ public class OpenIdConnectUserMapper extends OAuth2UserMapper {
accountDao.insert(newAccount);
roleDao.addUser(Role.USER, newAccount);
userOpt = usersApi.findByOAuth2ProviderId(oAuth2ProviderId);
if (config.isEnableRabbitmqEvents() && eventsSender != null) {
if (enableRabbitmq && eventsSender != null) {
eventsSender.sendNewOAuthAccountMessage(
oidcUser.getGivenName() + " " + oidcUser.getFamilyName(), oidcUser.getEmail(),
token.getAuthorizedClientRegistrationId());
Expand Down
2 changes: 1 addition & 1 deletion georchestra
Submodule georchestra updated 72 files
+6 −4 .github/workflows/analytics.yml
+6 −4 .github/workflows/console.yml
+4 −4 .github/workflows/database.yml
+5 −3 .github/workflows/datafeeder.yml
+4 −4 .github/workflows/geonetwork.yml
+5 −4 .github/workflows/geoserver.yml
+5 −4 .github/workflows/geowebcache.yml
+6 −4 .github/workflows/header.yml
+3 −3 .github/workflows/ldap.yml
+6 −4 .github/workflows/sp.yml
+2 −2 Makefile
+62 −57 RELEASE_PROCEDURE.md
+8 −4 commons/src/main/java/org/georchestra/security/api/UsersApi.java
+3 −0 commons/src/main/java/org/georchestra/security/model/GeorchestraUser.java
+1 −0 commons/src/main/java/org/georchestra/security/model/GeorchestraUserHasher.java
+2 −0 commons/src/main/java/org/georchestra/security/model/Organization.java
+10 −1 console/pom.xml
+27 −0 console/src/main/java/org/georchestra/console/events/DefaultPropsInitializer.java
+111 −0 console/src/main/java/org/georchestra/console/events/RabbitmqEventsListener.java
+34 −0 console/src/main/java/org/georchestra/console/events/RabbitmqEventsSender.java
+5 −1 console/src/main/java/org/georchestra/console/mailservice/Email.java
+30 −2 console/src/main/java/org/georchestra/console/mailservice/EmailFactory.java
+1 −1 console/src/main/java/org/georchestra/console/model/AdminLogType.java
+1 −0 console/src/main/java/org/georchestra/console/ws/backoffice/orgs/OrgsController.java
+1 −0 console/src/main/java/org/georchestra/console/ws/editorgdetails/EditOrgDetailsFormBean.java
+11 −1 console/src/main/java/org/georchestra/console/ws/editorgdetails/EditOrgDetailsFormController.java
+5 −0 console/src/main/java/org/georchestra/console/ws/newaccount/AccountFormBean.java
+3 −2 console/src/main/java/org/georchestra/console/ws/newaccount/NewAccountFormController.java
+30 −0 console/src/main/java/org/georchestra/console/ws/utils/LogUtils.java
+5 −0 console/src/main/resources/spring/rabbit-context-false.xml
+6 −0 console/src/main/resources/spring/rabbit-context-true.xml
+25 −0 console/src/main/resources/spring/rabbit-listener-context.xml
+18 −0 console/src/main/resources/spring/rabbit-sender-context.xml
+4 −0 console/src/main/webapp/WEB-INF/i18n/application.properties
+4 −0 console/src/main/webapp/WEB-INF/i18n/application_de.properties
+4 −0 console/src/main/webapp/WEB-INF/i18n/application_es.properties
+4 −0 console/src/main/webapp/WEB-INF/i18n/application_fr.properties
+32 −0 console/src/main/webapp/WEB-INF/i18n/application_nl.properties
+3 −0 console/src/main/webapp/WEB-INF/spring/webmvc-config.xml
+6 −4 console/src/main/webapp/WEB-INF/templates/newaccount-notification-template.txt
+4 −0 console/src/main/webapp/WEB-INF/views/createAccountForm.jsp
+3 −0 console/src/main/webapp/WEB-INF/views/editOrgDetailsForm.jsp
+18 −2 console/src/main/webapp/WEB-INF/views/welcomeNewUser.jsp
+4 −0 console/src/main/webapp/WEB-INF/web.xml
+2 −0 console/src/main/webapp/manager/app/assets/lang/de.json
+2 −0 console/src/main/webapp/manager/app/assets/lang/en.json
+2 −0 console/src/main/webapp/manager/app/assets/lang/es.json
+2 −0 console/src/main/webapp/manager/app/assets/lang/fr.json
+2 −0 console/src/main/webapp/manager/app/assets/lang/nl.json
+2 −1 console/src/main/webapp/manager/app/components/logger/logger.es6
+9 −1 console/src/main/webapp/manager/app/templates/orgForm.tpl.html
+1 −1 console/src/main/webapp/manager/app/templates/userForm.tpl.html
+0 −3 datafeeder/docker-compose.yml
+1 −1 datafeeder/src/main/java/org/georchestra/datafeeder/config/DataFeederConfigurationProperties.java
+5 −0 datafeeder/src/test/resources/datadir/console/console.properties
+6 −0 datafeeder/src/test/resources/datadir/default.properties
+6 −0 datafeeder/src/test/resources/datadir/geonetwork/geonetwork.properties
+1 −1 geonetwork
+1 −0 geoserver/webapp/src/docker/Dockerfile
+29 −62 ldap-account-management/src/main/java/org/georchestra/ds/orgs/Org.java
+4 −57 ldap-account-management/src/main/java/org/georchestra/ds/orgs/OrgExt.java
+3 −1 ldap-account-management/src/main/java/org/georchestra/ds/orgs/OrgsDaoImpl.java
+1 −0 ldap-account-management/src/main/java/org/georchestra/ds/security/OrganizationMapper.java
+4 −2 ldap-account-management/src/test/resources/defaultOrganizations.json
+3 −4 ldap/Dockerfile
+59 −0 ldap/README.md
+4 −4 ldap/docker-root/docker-entrypoint.d/01-populate
+6 −0 ldap/docker-root/georchestra.ldif
+1 −1 ldap/docker-root/georchestraSchema.ldif
+40 −7 migrations/master/README.md
+18 −0 migrations/master/add_extensible_object_orgs.sh
+10 −0 ...pring-integration/src/main/java/org/georchestra/security/client/console/GeorchestraConsoleUsersApiImpl.java

0 comments on commit 6bd2da2

Please sign in to comment.