use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class DuoSecurityAuthenticationEventExecutionPlanConfiguration method duoMultifactorAuthenticationProvider.
@ConditionalOnMissingBean(name = "duoMultifactorAuthenticationProvider")
@Bean
@RefreshScope
public VariegatedMultifactorAuthenticationProvider duoMultifactorAuthenticationProvider() {
final DefaultVariegatedMultifactorAuthenticationProvider provider = new DefaultVariegatedMultifactorAuthenticationProvider();
casProperties.getAuthn().getMfa().getDuo().stream().filter(duo -> StringUtils.isNotBlank(duo.getDuoApiHost()) && StringUtils.isNotBlank(duo.getDuoIntegrationKey()) && StringUtils.isNotBlank(duo.getDuoSecretKey()) && StringUtils.isNotBlank(duo.getDuoApplicationKey())).forEach(duo -> {
final BasicDuoSecurityAuthenticationService s = new BasicDuoSecurityAuthenticationService(duo, httpClient);
final DefaultDuoMultifactorAuthenticationProvider duoP = new DefaultDuoMultifactorAuthenticationProvider(duo.getRegistrationUrl(), s);
duoP.setGlobalFailureMode(casProperties.getAuthn().getMfa().getGlobalFailureMode());
duoP.setBypassEvaluator(MultifactorAuthenticationUtils.newMultifactorAuthenticationProviderBypass(duo.getBypass()));
duoP.setOrder(duo.getRank());
duoP.setId(duo.getId());
provider.addProvider(duoP);
});
if (provider.getProviders().isEmpty()) {
throw new IllegalArgumentException("At least one Duo instance must be defined");
}
return provider;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class DuoSecurityAuthenticationEventExecutionPlanConfiguration method duoAuthenticationHandler.
@RefreshScope
@Bean
public AuthenticationHandler duoAuthenticationHandler() {
final List<DuoSecurityMultifactorProperties> duos = casProperties.getAuthn().getMfa().getDuo();
if (duos.isEmpty()) {
throw new BeanCreationException("No configuration/settings could be found for Duo Security. Review settings and ensure the correct syntax is used");
}
final String name = duos.get(0).getName();
if (duos.size() > 1) {
LOGGER.debug("Multiple Duo Security providers are available; Duo authentication handler is named after [{}]", name);
}
final DuoAuthenticationHandler h = new DuoAuthenticationHandler(name, servicesManager, duoPrincipalFactory(), duoMultifactorAuthenticationProvider());
return h;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class DynamoDbTicketRegistryConfiguration method amazonDynamoDbClient.
@RefreshScope
@Bean
@SneakyThrows
public AmazonDynamoDB amazonDynamoDbClient() {
final DynamoDbTicketRegistryProperties dynamoDbProperties = casProperties.getTicket().getRegistry().getDynamoDb();
final AmazonDynamoDbClientFactory factory = new AmazonDynamoDbClientFactory();
return factory.createAmazonDynamoDb(dynamoDbProperties);
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class DynamoDbTicketRegistryConfiguration method ticketRegistry.
@Autowired
@RefreshScope
@Bean
public TicketRegistry ticketRegistry(@Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) {
final DynamoDbTicketRegistryProperties db = casProperties.getTicket().getRegistry().getDynamoDb();
final EncryptionRandomizedSigningJwtCryptographyProperties crypto = db.getCrypto();
return new DynamoDbTicketRegistry(CoreTicketUtils.newTicketRegistryCipherExecutor(crypto, "dynamoDb"), dynamoDbTicketRegistryFacilitator(ticketCatalog));
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class DynamoDbTicketRegistryConfiguration method dynamoDbTicketRegistryFacilitator.
@Autowired
@RefreshScope
@Bean
public DynamoDbTicketRegistryFacilitator dynamoDbTicketRegistryFacilitator(@Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) {
final DynamoDbTicketRegistryProperties db = casProperties.getTicket().getRegistry().getDynamoDb();
final DynamoDbTicketRegistryFacilitator f = new DynamoDbTicketRegistryFacilitator(ticketCatalog, db, amazonDynamoDbClient());
f.createTicketTables(db.isDropTablesOnStartup());
return f;
}
Aggregations