diff --git a/gateway/src/main/java/org/georchestra/gateway/events/RabbitmqEventsAutoConfiguration.java b/gateway/src/main/java/org/georchestra/gateway/events/RabbitmqEventsAutoConfiguration.java index 5d423ff5..448ea69e 100644 --- a/gateway/src/main/java/org/georchestra/gateway/events/RabbitmqEventsAutoConfiguration.java +++ b/gateway/src/main/java/org/georchestra/gateway/events/RabbitmqEventsAutoConfiguration.java @@ -14,7 +14,7 @@ @Configuration(proxyBeanMethods = false) @AutoConfigureAfter(GatewayAutoConfiguration.class) @ImportResource({ "classpath:rabbit-listener-context.xml", "classpath:rabbit-sender-context.xml" }) -@ConditionalOnExpression("${georchestra.gateway.security.enableRabbitmqEvents:true}") +@ConditionalOnExpression("${enableRabbitmqEvents:false}") public class RabbitmqEventsAutoConfiguration { @Bean diff --git a/gateway/src/main/java/org/georchestra/gateway/security/ldap/LdapConfigProperties.java b/gateway/src/main/java/org/georchestra/gateway/security/ldap/LdapConfigProperties.java index a3159f0f..9c817ab0 100644 --- a/gateway/src/main/java/org/georchestra/gateway/security/ldap/LdapConfigProperties.java +++ b/gateway/src/main/java/org/georchestra/gateway/security/ldap/LdapConfigProperties.java @@ -65,8 +65,6 @@ public class LdapConfigProperties implements Validator { private boolean createNonExistingUsersInLDAP = true; - private boolean enableRabbitmqEvents = true; - @Valid private Map ldap = Map.of(); diff --git a/gateway/src/main/java/org/georchestra/gateway/security/oauth2/OpenIdConnectUserMapper.java b/gateway/src/main/java/org/georchestra/gateway/security/oauth2/OpenIdConnectUserMapper.java index 646fe2fb..5af88485 100644 --- a/gateway/src/main/java/org/georchestra/gateway/security/oauth2/OpenIdConnectUserMapper.java +++ b/gateway/src/main/java/org/georchestra/gateway/security/oauth2/OpenIdConnectUserMapper.java @@ -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; @@ -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; @@ -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());