Class SmsAdapterConfiguration

java.lang.Object
com.irurueta.authserver.authorization.infrastructure.sms.SmsAdapterConfiguration

@Configuration(proxyBeanMethods=false) @EnableConfigurationProperties(SmsOutboxProperties.class) public class SmsAdapterConfiguration extends Object
Wires the phone normaliser and the logging SmsSender of development and tests. The profile expressions make the three senders (logging, Twilio, SNS) mutually exclusive in every combination of profiles: the logging one only under dev or test and when neither gateway profile is active, Twilio unless SNS is also active, and SNS whenever it is active. With none of those profiles there is no sender at all and MissingSmsGatewayConfiguration stops the startup: a deployment never silently keeps its messages in memory.
  • Field Details

    • LOGGING_SENDER_PROFILES

      public static final String LOGGING_SENDER_PROFILES
      Profiles under which the logging sender (and its outbox) is used: development or tests, and no gateway.
      See Also:
  • Constructor Details

    • SmsAdapterConfiguration

      public SmsAdapterConfiguration()
  • Method Details

    • phoneNormalizer

      @Bean public PhoneNormalizer phoneNormalizer()
      Creates the phone normaliser.
      Returns:
      the libphonenumber based normaliser.
    • phoneCountryResolver

      @Bean public PhoneCountryResolver phoneCountryResolver()
      Creates the resolver of the country of a phone number.
      Returns:
      the libphonenumber based resolver.
    • smsOutbox

      @Bean @Profile("(dev | test) & !twilio & !sns") public SmsOutbox smsOutbox(SmsOutboxProperties properties)
      Creates the outbox of the logging sender.
      Parameters:
      properties - outbox settings.
      Returns:
      the outbox, readable by the development inbox.
    • loggingSmsSender

      @Bean @Profile("(dev | test) & !twilio & !sns") public SmsSender loggingSmsSender(SmsOutbox outbox, Clock clock)
      Creates the logging sender of development and tests.
      Parameters:
      outbox - records the messages.
      clock - source of the recording instant.
      Returns:
      the logging sender.