use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project cas by apereo.
the class CasCoreTicketsConfiguration method ticketCatalog.
@ConditionalOnMissingBean(name = "ticketCatalog")
@Autowired
@Bean
public TicketCatalog ticketCatalog(final List<TicketCatalogConfigurer> configurers) {
final DefaultTicketCatalog plan = new DefaultTicketCatalog();
configurers.forEach(c -> {
final String name = StringUtils.removePattern(c.getClass().getSimpleName(), "\\$.+");
LOGGER.debug("Configuring ticket metadata registration plan [{}]", name);
c.configureTicketCatalog(plan);
});
return plan;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project cas by apereo.
the class CasCoreConfiguration method authenticationServiceSelectionPlan.
@ConditionalOnMissingBean(name = "authenticationServiceSelectionPlan")
@Autowired
@Bean
public AuthenticationServiceSelectionPlan authenticationServiceSelectionPlan(final List<AuthenticationServiceSelectionStrategyConfigurer> configurers) {
final DefaultAuthenticationServiceSelectionPlan plan = new DefaultAuthenticationServiceSelectionPlan();
configurers.forEach(c -> {
final String name = StringUtils.removePattern(c.getClass().getSimpleName(), "\\$.+");
LOGGER.debug("Configuring authentication request service selection strategy plan [{}]", name);
c.configureAuthenticationServiceSelectionStrategy(plan);
});
return plan;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project cas by apereo.
the class ElectronicFenceConfiguration method authenticationRiskEvaluator.
@ConditionalOnMissingBean(name = "authenticationRiskEvaluator")
@Bean
@RefreshScope
public AuthenticationRiskEvaluator authenticationRiskEvaluator() {
final RiskBasedAuthenticationProperties risk = casProperties.getAuthn().getAdaptive().getRisk();
final Set<AuthenticationRequestRiskCalculator> calculators = new HashSet<>();
if (risk.getIp().isEnabled()) {
calculators.add(ipAddressAuthenticationRequestRiskCalculator());
}
if (risk.getAgent().isEnabled()) {
calculators.add(userAgentAuthenticationRequestRiskCalculator());
}
if (risk.getDateTime().isEnabled()) {
calculators.add(dateTimeAuthenticationRequestRiskCalculator());
}
if (risk.getGeoLocation().isEnabled()) {
calculators.add(geoLocationAuthenticationRequestRiskCalculator());
}
if (calculators.isEmpty()) {
LOGGER.warn("No risk calculators are defined to examine authentication requests");
}
return new DefaultAuthenticationRiskEvaluator(calculators);
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project cas by apereo.
the class ElectronicFenceConfiguration method blockAuthenticationContingencyPlan.
@ConditionalOnMissingBean(name = "blockAuthenticationContingencyPlan")
@Bean
@RefreshScope
public AuthenticationRiskContingencyPlan blockAuthenticationContingencyPlan() {
final BlockAuthenticationContingencyPlan b = new BlockAuthenticationContingencyPlan();
configureContingencyPlan(b);
return b;
}
use of org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean in project zipkin by openzipkin.
the class ZipkinElasticsearchAwsStorageAutoConfiguration method credentials.
/** By default, get credentials from the {@link DefaultAWSCredentialsProviderChain} */
@Bean
@ConditionalOnMissingBean
AWSCredentials.Provider credentials() {
return new AWSCredentials.Provider() {
AWSCredentialsProvider delegate = new DefaultAWSCredentialsProviderChain();
@Override
public AWSCredentials get() {
com.amazonaws.auth.AWSCredentials result = delegate.getCredentials();
String sessionToken = result instanceof AWSSessionCredentials ? ((AWSSessionCredentials) result).getSessionToken() : null;
return new AWSCredentials(result.getAWSAccessKeyId(), result.getAWSSecretKey(), sessionToken);
}
};
}
Aggregations