use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CouchbaseServiceRegistryConfiguration method serviceRegistryCouchbaseClientFactory.
/**
* Service registry couchbase client factory couchbase client factory.
*
* @return the couchbase client factory
*/
@RefreshScope
@Bean
public CouchbaseClientFactory serviceRegistryCouchbaseClientFactory() {
final CouchbaseServiceRegistryProperties couchbase = casProperties.getServiceRegistry().getCouchbase();
final Set<String> nodes = StringUtils.commaDelimitedListToSet(couchbase.getNodeSet());
return new CouchbaseClientFactory(nodes, couchbase.getBucket(), couchbase.getPassword(), couchbase.getTimeout());
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CouchbaseTicketRegistryConfiguration method ticketRegistry.
@RefreshScope
@Bean
public TicketRegistry ticketRegistry() {
final CouchbaseTicketRegistryProperties couchbase = casProperties.getTicket().getRegistry().getCouchbase();
final CouchbaseTicketRegistry c = new CouchbaseTicketRegistry(ticketRegistryCouchbaseClientFactory(), couchbase.isQueryEnabled());
c.setCipherExecutor(Beans.newTicketRegistryCipherExecutor(couchbase.getCrypto()));
return c;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CouchbaseTicketRegistryConfiguration method ticketRegistryCouchbaseClientFactory.
@RefreshScope
@Bean
public CouchbaseClientFactory ticketRegistryCouchbaseClientFactory() {
final CouchbaseTicketRegistryProperties cb = casProperties.getTicket().getRegistry().getCouchbase();
final Set<String> nodes = StringUtils.commaDelimitedListToSet(cb.getNodeSet());
return new CouchbaseClientFactory(nodes, cb.getBucket(), cb.getPassword(), cb.getTimeout());
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class DynamoDbTicketRegistryConfiguration method amazonDynamoDbClient.
@RefreshScope
@Bean
public AmazonDynamoDBClient amazonDynamoDbClient() {
try {
final DynamoDbTicketRegistryProperties dynamoDbProperties = casProperties.getTicket().getRegistry().getDynamoDb();
final ClientConfiguration cfg = new ClientConfiguration();
cfg.setConnectionTimeout(dynamoDbProperties.getConnectionTimeout());
cfg.setMaxConnections(dynamoDbProperties.getMaxConnections());
cfg.setRequestTimeout(dynamoDbProperties.getRequestTimeout());
cfg.setSocketTimeout(dynamoDbProperties.getSocketTimeout());
cfg.setUseGzip(dynamoDbProperties.isUseGzip());
cfg.setUseReaper(dynamoDbProperties.isUseReaper());
cfg.setUseThrottleRetries(dynamoDbProperties.isUseThrottleRetries());
cfg.setUseTcpKeepAlive(dynamoDbProperties.isUseTcpKeepAlive());
cfg.setProtocol(Protocol.valueOf(dynamoDbProperties.getProtocol().toUpperCase()));
cfg.setClientExecutionTimeout(dynamoDbProperties.getClientExecutionTimeout());
cfg.setCacheResponseMetadata(dynamoDbProperties.isCacheResponseMetadata());
if (StringUtils.isNotBlank(dynamoDbProperties.getLocalAddress())) {
cfg.setLocalAddress(InetAddress.getByName(dynamoDbProperties.getLocalAddress()));
}
AWSCredentials credentials = null;
if (dynamoDbProperties.getCredentialsPropertiesFile() != null) {
credentials = new PropertiesCredentials(dynamoDbProperties.getCredentialsPropertiesFile().getInputStream());
} else if (StringUtils.isNotBlank(dynamoDbProperties.getCredentialAccessKey()) && StringUtils.isNotBlank(dynamoDbProperties.getCredentialSecretKey())) {
credentials = new BasicAWSCredentials(dynamoDbProperties.getCredentialAccessKey(), dynamoDbProperties.getCredentialSecretKey());
}
final AmazonDynamoDBClient client;
if (credentials == null) {
client = new AmazonDynamoDBClient(cfg);
} else {
client = new AmazonDynamoDBClient(credentials, cfg);
}
if (StringUtils.isNotBlank(dynamoDbProperties.getEndpoint())) {
client.setEndpoint(dynamoDbProperties.getEndpoint());
}
if (StringUtils.isNotBlank(dynamoDbProperties.getRegion())) {
client.setRegion(Region.getRegion(Regions.valueOf(dynamoDbProperties.getRegion())));
}
if (StringUtils.isNotBlank(dynamoDbProperties.getRegionOverride())) {
client.setSignerRegionOverride(dynamoDbProperties.getRegionOverride());
}
if (StringUtils.isNotBlank(dynamoDbProperties.getServiceNameIntern())) {
client.setServiceNameIntern(dynamoDbProperties.getServiceNameIntern());
}
if (dynamoDbProperties.getTimeOffset() != 0) {
client.setTimeOffset(dynamoDbProperties.getTimeOffset());
}
return client;
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
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 CryptographyProperties crypto = db.getCrypto();
return new DynamoDbTicketRegistry(Beans.newTicketRegistryCipherExecutor(crypto), dynamoDbTicketRegistryFacilitator(ticketCatalog));
}
Aggregations