Polishing.
Reformar code.
This commit is contained in:
@@ -27,9 +27,9 @@ import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Annotation providing a convenient and declarative mechanism for adding a
|
||||
* {@link VaultPropertySource} to Spring's {@link org.springframework.core.env.Environment
|
||||
* Environment}. To be used in conjunction with @{@link Configuration} classes.
|
||||
* <h3>Example usage</h3>
|
||||
* {@link VaultPropertySource} to Spring's
|
||||
* {@link org.springframework.core.env.Environment Environment}. To be used in conjunction
|
||||
* with @{@link Configuration} classes. <h3>Example usage</h3>
|
||||
* <p>
|
||||
* Given a Vault path {@code secret/my-application} containing the configuration data pair
|
||||
* {@code database.password=mysecretpassword}, the following {@code @Configuration} class
|
||||
@@ -65,8 +65,9 @@ import org.springframework.context.annotation.Import;
|
||||
* ordering is difficult to predict. In such cases - and if overriding is important - it
|
||||
* is recommended that the user fall back to using the programmatic PropertySource API.
|
||||
* See {@link org.springframework.core.env.ConfigurableEnvironment
|
||||
* ConfigurableEnvironment} and {@link org.springframework.core.env.MutablePropertySources
|
||||
* MutablePropertySources} javadocs for details.
|
||||
* ConfigurableEnvironment} and
|
||||
* {@link org.springframework.core.env.MutablePropertySources MutablePropertySources}
|
||||
* javadocs for details.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
@@ -53,8 +53,8 @@ import org.springframework.vault.core.util.PropertyTransformers;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
class VaultPropertySourceRegistrar
|
||||
implements ImportBeanDefinitionRegistrar, BeanFactoryPostProcessor {
|
||||
class VaultPropertySourceRegistrar implements ImportBeanDefinitionRegistrar,
|
||||
BeanFactoryPostProcessor {
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
|
||||
@@ -63,15 +63,16 @@ class VaultPropertySourceRegistrar
|
||||
ConfigurableEnvironment env = beanFactory.getBean(ConfigurableEnvironment.class);
|
||||
MutablePropertySources propertySources = env.getPropertySources();
|
||||
|
||||
registerPropertySources(beanFactory
|
||||
.getBeansOfType(
|
||||
registerPropertySources(
|
||||
beanFactory.getBeansOfType(
|
||||
org.springframework.vault.core.env.VaultPropertySource.class)
|
||||
.values(), propertySources);
|
||||
.values(), propertySources);
|
||||
|
||||
registerPropertySources(beanFactory
|
||||
.getBeansOfType(
|
||||
org.springframework.vault.core.env.LeaseAwareVaultPropertySource.class)
|
||||
.values(), propertySources);
|
||||
registerPropertySources(
|
||||
beanFactory
|
||||
.getBeansOfType(
|
||||
org.springframework.vault.core.env.LeaseAwareVaultPropertySource.class)
|
||||
.values(), propertySources);
|
||||
}
|
||||
|
||||
private void registerPropertySources(
|
||||
@@ -121,9 +122,8 @@ class VaultPropertySourceRegistrar
|
||||
"'vaultTemplateRef' in @EnableVaultPropertySource must not be empty");
|
||||
|
||||
PropertyTransformer propertyTransformer = StringUtils
|
||||
.hasText(propertyNamePrefix)
|
||||
? PropertyTransformers.propertyNamePrefix(propertyNamePrefix)
|
||||
: PropertyTransformers.noop();
|
||||
.hasText(propertyNamePrefix) ? PropertyTransformers
|
||||
.propertyNamePrefix(propertyNamePrefix) : PropertyTransformers.noop();
|
||||
|
||||
for (String propertyPath : paths) {
|
||||
|
||||
@@ -131,8 +131,8 @@ class VaultPropertySourceRegistrar
|
||||
continue;
|
||||
}
|
||||
|
||||
AbstractBeanDefinition beanDefinition = createBeanDefinition(ref, renewal,
|
||||
propertyTransformer, propertyPath);
|
||||
AbstractBeanDefinition beanDefinition = createBeanDefinition(ref,
|
||||
renewal, propertyTransformer, propertyPath);
|
||||
|
||||
registry.registerBeanDefinition("vaultPropertySource#" + counter,
|
||||
beanDefinition);
|
||||
@@ -148,20 +148,19 @@ class VaultPropertySourceRegistrar
|
||||
BeanDefinitionBuilder builder;
|
||||
|
||||
if (isRenewable(renewal)) {
|
||||
builder = BeanDefinitionBuilder.rootBeanDefinition(
|
||||
org.springframework.vault.core.env.LeaseAwareVaultPropertySource.class);
|
||||
builder = BeanDefinitionBuilder
|
||||
.rootBeanDefinition(org.springframework.vault.core.env.LeaseAwareVaultPropertySource.class);
|
||||
|
||||
RequestedSecret requestedSecret = renewal == Renewal.ROTATE
|
||||
? RequestedSecret.rotating(propertyPath)
|
||||
: RequestedSecret.renewable(propertyPath);
|
||||
RequestedSecret requestedSecret = renewal == Renewal.ROTATE ? RequestedSecret
|
||||
.rotating(propertyPath) : RequestedSecret.renewable(propertyPath);
|
||||
|
||||
builder.addConstructorArgValue(propertyPath);
|
||||
builder.addConstructorArgReference("secretLeaseContainer");
|
||||
builder.addConstructorArgValue(requestedSecret);
|
||||
}
|
||||
else {
|
||||
builder = BeanDefinitionBuilder.rootBeanDefinition(
|
||||
org.springframework.vault.core.env.VaultPropertySource.class);
|
||||
builder = BeanDefinitionBuilder
|
||||
.rootBeanDefinition(org.springframework.vault.core.env.VaultPropertySource.class);
|
||||
|
||||
builder.addConstructorArgValue(propertyPath);
|
||||
builder.addConstructorArgReference(ref);
|
||||
@@ -186,8 +185,8 @@ class VaultPropertySourceRegistrar
|
||||
addAttributesIfNotNull(result,
|
||||
metadata.getAnnotationAttributes(annotationClassName, false));
|
||||
|
||||
Map<String, Object> container = metadata
|
||||
.getAnnotationAttributes(containerClassName, false);
|
||||
Map<String, Object> container = metadata.getAnnotationAttributes(
|
||||
containerClassName, false);
|
||||
if (container != null && container.containsKey("value")) {
|
||||
for (Map<String, Object> containedAttributes : (Map<String, Object>[]) container
|
||||
.get("value")) {
|
||||
|
||||
@@ -73,9 +73,8 @@ public abstract class AbstractVaultConfiguration implements ApplicationContextAw
|
||||
*/
|
||||
@Bean
|
||||
public VaultTemplate vaultTemplate() {
|
||||
return new VaultTemplate(vaultEndpoint(),
|
||||
clientHttpRequestFactoryWrapper().getClientHttpRequestFactory(),
|
||||
sessionManager());
|
||||
return new VaultTemplate(vaultEndpoint(), clientHttpRequestFactoryWrapper()
|
||||
.getClientHttpRequestFactory(), sessionManager());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,8 +169,8 @@ public abstract class AbstractVaultConfiguration implements ApplicationContextAw
|
||||
*/
|
||||
@Bean
|
||||
public ClientFactoryWrapper clientHttpRequestFactoryWrapper() {
|
||||
return new ClientFactoryWrapper(ClientHttpRequestFactoryFactory
|
||||
.create(clientOptions(), sslConfiguration()));
|
||||
return new ClientFactoryWrapper(ClientHttpRequestFactoryFactory.create(
|
||||
clientOptions(), sslConfiguration()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.springframework.vault.authentication.AppRoleAuthentication;
|
||||
import org.springframework.vault.authentication.AppRoleAuthenticationOptions;
|
||||
import org.springframework.vault.authentication.AwsEc2Authentication;
|
||||
import org.springframework.vault.authentication.AwsEc2AuthenticationOptions;
|
||||
import org.springframework.vault.authentication.AwsEc2AuthenticationOptions.AwsEc2AuthenticationOptionsBuilder;
|
||||
import org.springframework.vault.authentication.ClientAuthentication;
|
||||
import org.springframework.vault.authentication.ClientCertificateAuthentication;
|
||||
import org.springframework.vault.authentication.CubbyholeAuthentication;
|
||||
@@ -40,6 +39,7 @@ import org.springframework.vault.authentication.IpAddressUserId;
|
||||
import org.springframework.vault.authentication.MacAddressUserId;
|
||||
import org.springframework.vault.authentication.StaticUserId;
|
||||
import org.springframework.vault.authentication.TokenAuthentication;
|
||||
import org.springframework.vault.authentication.AwsEc2AuthenticationOptions.AwsEc2AuthenticationOptionsBuilder;
|
||||
import org.springframework.vault.client.VaultEndpoint;
|
||||
import org.springframework.vault.support.SslConfiguration;
|
||||
import org.springframework.vault.support.VaultToken;
|
||||
@@ -133,8 +133,8 @@ import org.springframework.web.client.RestOperations;
|
||||
* @see CubbyholeAuthentication
|
||||
*/
|
||||
@Configuration
|
||||
public class EnvironmentVaultConfiguration extends AbstractVaultConfiguration
|
||||
implements ApplicationContextAware {
|
||||
public class EnvironmentVaultConfiguration extends AbstractVaultConfiguration implements
|
||||
ApplicationContextAware {
|
||||
|
||||
private RestOperations cachedRestOperations;
|
||||
private ApplicationContext applicationContext;
|
||||
@@ -281,8 +281,8 @@ public class EnvironmentVaultConfiguration extends AbstractVaultConfiguration
|
||||
Assert.hasText(roleId,
|
||||
"Vault AWS EC2 authentication: RoleId (vault.aws-ec2.role-id) must not be empty");
|
||||
|
||||
AwsEc2AuthenticationOptionsBuilder builder = AwsEc2AuthenticationOptions.builder()
|
||||
.role(roleId);
|
||||
AwsEc2AuthenticationOptionsBuilder builder = AwsEc2AuthenticationOptions
|
||||
.builder().role(roleId);
|
||||
|
||||
if (StringUtils.hasText(identityDocument)) {
|
||||
builder.identityDocumentUri(URI.create(identityDocument));
|
||||
|
||||
@@ -245,7 +245,7 @@ public class VaultSysTemplate implements VaultSysOperations {
|
||||
|
||||
ResponseEntity<VaultMountsResponse> exchange = restOperations.exchange(path,
|
||||
HttpMethod.GET, null, MOUNT_TYPE_REF,
|
||||
Collections.<String, Object> emptyMap());
|
||||
Collections.<String, Object>emptyMap());
|
||||
|
||||
VaultMountsResponse body = exchange.getBody();
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ import org.springframework.vault.support.JsonMapFlattener;
|
||||
* @see PropertyTransformer
|
||||
* @see PropertyTransformers
|
||||
*/
|
||||
public class LeaseAwareVaultPropertySource
|
||||
extends EnumerablePropertySource<VaultOperations> {
|
||||
public class LeaseAwareVaultPropertySource extends
|
||||
EnumerablePropertySource<VaultOperations> {
|
||||
|
||||
private final static Log logger = LogFactory
|
||||
.getLog(LeaseAwareVaultPropertySource.class);
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@@ -65,30 +65,30 @@ import org.springframework.web.client.RestOperations;
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
SecretLeaseContainer container = new SecretLeaseContainer(vaultOperations,
|
||||
taskScheduler);
|
||||
|
||||
final RequestedSecret requestedSecret = container
|
||||
.requestRotatingSecret("mysql/creds/my-role");
|
||||
container.addLeaseListener(new LeaseListenerAdapter() {
|
||||
@Override
|
||||
public void onLeaseEvent(LeaseEvent leaseEvent) {
|
||||
|
||||
if (requestedSecret == leaseEvent.getSource()) {
|
||||
|
||||
if (leaseEvent instanceof LeaseCreatedEvent) {
|
||||
|
||||
}
|
||||
|
||||
if (leaseEvent instanceof LeaseExpiredEvent) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
container.afterPropertiesSet();
|
||||
container.start(); // events are triggered after starting the container
|
||||
* SecretLeaseContainer container = new SecretLeaseContainer(vaultOperations,
|
||||
* taskScheduler);
|
||||
*
|
||||
* final RequestedSecret requestedSecret = container
|
||||
* .requestRotatingSecret("mysql/creds/my-role");
|
||||
* container.addLeaseListener(new LeaseListenerAdapter() {
|
||||
* @Override
|
||||
* public void onLeaseEvent(LeaseEvent leaseEvent) {
|
||||
*
|
||||
* if (requestedSecret == leaseEvent.getSource()) {
|
||||
*
|
||||
* if (leaseEvent instanceof LeaseCreatedEvent) {
|
||||
*
|
||||
* }
|
||||
*
|
||||
* if (leaseEvent instanceof LeaseExpiredEvent) {
|
||||
*
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* container.afterPropertiesSet();
|
||||
* container.start(); // events are triggered after starting the container
|
||||
* </code>
|
||||
* </pre>
|
||||
* <p>
|
||||
@@ -115,8 +115,8 @@ container.start(); // events are triggered after starting the container
|
||||
* @see Lease
|
||||
*/
|
||||
@CommonsLog
|
||||
public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
implements InitializingBean, DisposableBean {
|
||||
public class SecretLeaseContainer extends SecretLeaseEventPublisher implements
|
||||
InitializingBean, DisposableBean {
|
||||
|
||||
private final static AtomicIntegerFieldUpdater<SecretLeaseContainer> UPDATER = AtomicIntegerFieldUpdater
|
||||
.newUpdater(SecretLeaseContainer.class, "status");
|
||||
@@ -337,8 +337,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.setDaemon(true);
|
||||
scheduler.setThreadNamePrefix(String.format("%s-%d-",
|
||||
getClass().getSimpleName(), poolId.incrementAndGet()));
|
||||
scheduler.setThreadNamePrefix(String.format("%s-%d-", getClass()
|
||||
.getSimpleName(), poolId.incrementAndGet()));
|
||||
scheduler.afterPropertiesSet();
|
||||
|
||||
this.taskScheduler = scheduler;
|
||||
@@ -346,8 +346,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
}
|
||||
|
||||
for (RequestedSecret requestedSecret : requestedSecrets) {
|
||||
this.renewals.put(requestedSecret,
|
||||
new LeaseRenewalScheduler(this.taskScheduler));
|
||||
this.renewals.put(requestedSecret, new LeaseRenewalScheduler(
|
||||
this.taskScheduler));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,8 +457,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
protected Lease doRenewLease(RequestedSecret requestedSecret, final Lease lease) {
|
||||
|
||||
try {
|
||||
ResponseEntity<Map<String, Object>> entity = operations.doWithSession(
|
||||
new RestOperationsCallback<ResponseEntity<Map<String, Object>>>() {
|
||||
ResponseEntity<Map<String, Object>> entity = operations
|
||||
.doWithSession(new RestOperationsCallback<ResponseEntity<Map<String, Object>>>() {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -488,7 +488,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
onLeaseExpired(requestedSecret, lease);
|
||||
}
|
||||
|
||||
onError(requestedSecret, lease,
|
||||
onError(requestedSecret,
|
||||
lease,
|
||||
new VaultException(String.format("Cannot renew lease: %s",
|
||||
VaultResponses.getError(e.getResponseBodyAsString()))));
|
||||
}
|
||||
@@ -528,8 +529,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
|
||||
onBeforeLeaseRevocation(requestedSecret, lease);
|
||||
|
||||
operations.doWithSession(
|
||||
new RestOperationsCallback<ResponseEntity<Map<String, Object>>>() {
|
||||
operations
|
||||
.doWithSession(new RestOperationsCallback<ResponseEntity<Map<String, Object>>>() {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -544,7 +545,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
onAfterLeaseRevocation(requestedSecret, lease);
|
||||
}
|
||||
catch (HttpStatusCodeException e) {
|
||||
onError(requestedSecret, lease,
|
||||
onError(requestedSecret,
|
||||
lease,
|
||||
new VaultException(String.format("Cannot revoke lease: %s",
|
||||
VaultResponses.getError(e.getResponseBodyAsString()))));
|
||||
}
|
||||
@@ -603,35 +605,38 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
cancelSchedule(currentLease);
|
||||
}
|
||||
|
||||
ScheduledFuture<?> scheduledFuture = taskScheduler.schedule(new Runnable() {
|
||||
ScheduledFuture<?> scheduledFuture = taskScheduler.schedule(
|
||||
new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
try {
|
||||
try {
|
||||
|
||||
schedules.remove(lease);
|
||||
schedules.remove(lease);
|
||||
|
||||
if (currentLeaseRef.get() != lease) {
|
||||
log.debug("Current lease has changed. Skipping renewal");
|
||||
return;
|
||||
if (currentLeaseRef.get() != lease) {
|
||||
log.debug("Current lease has changed. Skipping renewal");
|
||||
return;
|
||||
}
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Renewing lease %s",
|
||||
lease.getLeaseId()));
|
||||
}
|
||||
|
||||
currentLeaseRef.compareAndSet(lease,
|
||||
renewLease.renewLease(lease));
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(
|
||||
String.format("Cannot renew lease %s",
|
||||
lease.getLeaseId()), e);
|
||||
}
|
||||
}
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(String.format("Renewing lease %s",
|
||||
lease.getLeaseId()));
|
||||
}
|
||||
|
||||
currentLeaseRef.compareAndSet(lease,
|
||||
renewLease.renewLease(lease));
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(String.format("Cannot renew lease %s",
|
||||
lease.getLeaseId()), e);
|
||||
}
|
||||
}
|
||||
}, new OneShotTrigger(
|
||||
getRenewalSeconds(lease, minRenewalSeconds, expiryThresholdSeconds)));
|
||||
},
|
||||
new OneShotTrigger(getRenewalSeconds(lease, minRenewalSeconds,
|
||||
expiryThresholdSeconds)));
|
||||
|
||||
schedules.put(lease, scheduledFuture);
|
||||
}
|
||||
@@ -667,8 +672,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
|
||||
private long getRenewalSeconds(Lease lease, int minRenewalSeconds,
|
||||
int expiryThresholdSeconds) {
|
||||
return Math.max(minRenewalSeconds,
|
||||
lease.getLeaseDuration() - expiryThresholdSeconds);
|
||||
return Math.max(minRenewalSeconds, lease.getLeaseDuration()
|
||||
- expiryThresholdSeconds);
|
||||
}
|
||||
|
||||
private boolean isLeaseRenewable(Lease lease) {
|
||||
@@ -705,8 +710,8 @@ public class SecretLeaseContainer extends SecretLeaseEventPublisher
|
||||
public Date nextExecutionTime(TriggerContext triggerContext) {
|
||||
|
||||
if (UPDATER.compareAndSet(this, STATUS_ARMED, STATUS_FIRED)) {
|
||||
return new Date(
|
||||
System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(seconds));
|
||||
return new Date(System.currentTimeMillis()
|
||||
+ TimeUnit.SECONDS.toMillis(seconds));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -39,8 +39,8 @@ import org.springframework.vault.core.lease.event.SecretLeaseExpiredEvent;
|
||||
* Publisher for {@link SecretLeaseEvent}s.
|
||||
* <p>
|
||||
* This publisher dispatches events to {@link LeaseListener} and
|
||||
* {@link LeaseErrorListener}. Instances are thread-safe once {@link #afterPropertiesSet()
|
||||
* initialized}.
|
||||
* {@link LeaseErrorListener}. Instances are thread-safe once
|
||||
* {@link #afterPropertiesSet() initialized}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @see SecretLeaseEvent
|
||||
@@ -118,8 +118,8 @@ public class SecretLeaseEventPublisher implements InitializingBean {
|
||||
Map<String, Object> body) {
|
||||
|
||||
for (LeaseListener leaseListener : leaseListeners) {
|
||||
leaseListener.onLeaseEvent(
|
||||
new SecretLeaseCreatedEvent(requestedSecret, lease, body));
|
||||
leaseListener.onLeaseEvent(new SecretLeaseCreatedEvent(requestedSecret,
|
||||
lease, body));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@ public class SecretLeaseEventPublisher implements InitializingBean {
|
||||
protected void onAfterLeaseRenewed(RequestedSecret requestedSecret, Lease lease) {
|
||||
|
||||
for (LeaseListener leaseListener : leaseListeners) {
|
||||
leaseListener.onLeaseEvent(
|
||||
new AfterSecretLeaseRenewedEvent(requestedSecret, lease));
|
||||
leaseListener.onLeaseEvent(new AfterSecretLeaseRenewedEvent(requestedSecret,
|
||||
lease));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,8 +150,8 @@ public class SecretLeaseEventPublisher implements InitializingBean {
|
||||
protected void onBeforeLeaseRevocation(RequestedSecret requestedSecret, Lease lease) {
|
||||
|
||||
for (LeaseListener leaseListener : leaseListeners) {
|
||||
leaseListener.onLeaseEvent(
|
||||
new BeforeSecretLeaseRevocationEvent(requestedSecret, lease));
|
||||
leaseListener.onLeaseEvent(new BeforeSecretLeaseRevocationEvent(
|
||||
requestedSecret, lease));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +166,8 @@ public class SecretLeaseEventPublisher implements InitializingBean {
|
||||
protected void onAfterLeaseRevocation(RequestedSecret requestedSecret, Lease lease) {
|
||||
|
||||
for (LeaseListener leaseListener : leaseListeners) {
|
||||
leaseListener.onLeaseEvent(
|
||||
new AfterSecretLeaseRevocationEvent(requestedSecret, lease));
|
||||
leaseListener.onLeaseEvent(new AfterSecretLeaseRevocationEvent(
|
||||
requestedSecret, lease));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,8 +199,8 @@ public class SecretLeaseEventPublisher implements InitializingBean {
|
||||
protected void onError(RequestedSecret requestedSecret, Lease lease, Exception e) {
|
||||
|
||||
for (LeaseErrorListener leaseErrorListener : leaseErrorListeners) {
|
||||
leaseErrorListener.onLeaseError(
|
||||
new SecretLeaseErrorEvent(requestedSecret, lease, e), e);
|
||||
leaseErrorListener.onLeaseError(new SecretLeaseErrorEvent(requestedSecret,
|
||||
lease, e), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,8 +214,9 @@ public class SecretLeaseEventPublisher implements InitializingBean {
|
||||
|
||||
@Override
|
||||
public void onLeaseError(SecretLeaseEvent leaseEvent, Exception exception) {
|
||||
log.warn(String.format("[%s] %s %s", leaseEvent.getSource(),
|
||||
leaseEvent.getLease(), exception.getMessage()), exception);
|
||||
log.warn(
|
||||
String.format("[%s] %s %s", leaseEvent.getSource(),
|
||||
leaseEvent.getLease(), exception.getMessage()), exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
* Lease domain classes.
|
||||
*/
|
||||
package org.springframework.vault.core.lease.domain;
|
||||
|
||||
|
||||
@@ -36,8 +36,7 @@ public class BeforeSecretLeaseRevocationEvent extends SecretLeaseEvent {
|
||||
* @param requestedSecret must not be {@literal null}.
|
||||
* @param lease must not be {@literal null}.
|
||||
*/
|
||||
public BeforeSecretLeaseRevocationEvent(RequestedSecret requestedSecret,
|
||||
Lease lease) {
|
||||
public BeforeSecretLeaseRevocationEvent(RequestedSecret requestedSecret, Lease lease) {
|
||||
super(requestedSecret, lease);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
* Support classes for lease application events.
|
||||
*/
|
||||
package org.springframework.vault.core.lease.event;
|
||||
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
* The core package implementing lease renewal and secret rotation.
|
||||
*/
|
||||
package org.springframework.vault.core.lease;
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ import java.util.List;
|
||||
class KeystoreUtil {
|
||||
|
||||
/**
|
||||
* Create a {@link KeyStore} containing the {@link KeySpec} and {@link X509Certificate
|
||||
* certificates} using the given {@code keyAlias}.
|
||||
* Create a {@link KeyStore} containing the {@link KeySpec} and
|
||||
* {@link X509Certificate certificates} using the given {@code keyAlias}.
|
||||
*
|
||||
* @param keyAlias
|
||||
* @param certificates
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.springframework.vault.support;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
/**
|
||||
* Value object to bind generic Vault HTTP API responses.
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user