Skip to content

Commit

Permalink
making rabbitmq optional for gateway - desactived bt default
Browse files Browse the repository at this point in the history
  • Loading branch information
marwanehcine committed Sep 27, 2023
1 parent 8180e6a commit d73754c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

0 comments on commit d73754c

Please sign in to comment.