Merge branch '1.5.x'
This commit is contained in:
@@ -93,6 +93,7 @@ public class CacheStatisticsAutoConfiguration {
|
||||
public HazelcastCacheStatisticsProvider hazelcastCacheStatisticsProvider() {
|
||||
return new HazelcastCacheStatisticsProvider();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -83,4 +83,5 @@ public class EndpointMBeanExportProperties {
|
||||
public void setStaticNames(String[] staticNames) {
|
||||
this.staticNames = StringUtils.splitArrayElementsIntoProperties(staticNames, "=");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -266,6 +266,7 @@ public class EndpointWebMvcAutoConfiguration
|
||||
@Conditional(OnManagementMvcCondition.class)
|
||||
@Import(ManagementContextConfigurationsImportSelector.class)
|
||||
protected static class EndpointWebMvcConfiguration {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,4 +43,5 @@ public class JolokiaProperties {
|
||||
public void setConfig(Map<String, String> config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ public class ManagementWebSecurityAutoConfiguration {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -158,6 +159,7 @@ public class ManagementWebSecurityAutoConfiguration {
|
||||
@Conditional(WebSecurityEnablerCondition.class)
|
||||
@EnableWebSecurity
|
||||
protected static class WebSecurityEnabler extends AuthenticationManagerConfiguration {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -67,7 +67,6 @@ import org.springframework.messaging.MessageChannel;
|
||||
* @see MetricWriter
|
||||
* @see InMemoryMetricRepository
|
||||
* @see Exporter
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@@ -108,6 +107,7 @@ public class MetricRepositoryAutoConfiguration {
|
||||
public BufferGaugeService gaugeService(GaugeBuffers writer) {
|
||||
return new BufferGaugeService(writer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -145,7 +145,8 @@ final class MetricsFilter extends OncePerRequestFilter {
|
||||
suffix);
|
||||
}
|
||||
|
||||
private String determineMetricNameSuffix(HttpServletRequest request, String path, int status) {
|
||||
private String determineMetricNameSuffix(HttpServletRequest request, String path,
|
||||
int status) {
|
||||
Object bestMatchingPattern = request
|
||||
.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
|
||||
if (bestMatchingPattern != null) {
|
||||
|
||||
@@ -101,7 +101,6 @@ public class CloudFoundryActuatorAutoConfiguration {
|
||||
|
||||
/**
|
||||
* Nested configuration for ignored requests if Spring Security is present.
|
||||
*
|
||||
*/
|
||||
@ConditionalOnClass(WebSecurity.class)
|
||||
static class CloudFoundryIgnoredRequestConfiguration {
|
||||
|
||||
@@ -59,4 +59,5 @@ public class BeansEndpoint extends AbstractEndpoint<List<Object>>
|
||||
public List<Object> invoke() {
|
||||
return this.parser.parseList(this.liveBeansView.getSnapshotAsJson());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -332,6 +332,7 @@ public class ConfigurationPropertiesReportEndpoint
|
||||
}
|
||||
return setter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,4 +93,5 @@ public class HealthEndpoint extends AbstractEndpoint<Health> {
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,4 +47,5 @@ public class TraceEndpoint extends AbstractEndpoint<List<Trace>> {
|
||||
public List<Trace> invoke() {
|
||||
return this.repository.findAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,4 +47,5 @@ public class ShutdownEndpointMBean extends EndpointMBean {
|
||||
public Object shutdown() {
|
||||
return convert(getEndpoint().invoke());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,4 +58,5 @@ public class HalJsonMvcEndpoint extends AbstractNamedMvcEndpoint {
|
||||
protected final ManagementServletContext getManagementServletContext() {
|
||||
return this.managementServletContext;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ import org.springframework.web.util.UrlPathHelper;
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "endpoints.jolokia", ignoreUnknownFields = false)
|
||||
@HypermediaDisabled
|
||||
public class JolokiaMvcEndpoint extends AbstractNamedMvcEndpoint
|
||||
implements InitializingBean, ApplicationContextAware, ServletContextAware, DisposableBean {
|
||||
public class JolokiaMvcEndpoint extends AbstractNamedMvcEndpoint implements
|
||||
InitializingBean, ApplicationContextAware, ServletContextAware, DisposableBean {
|
||||
|
||||
private final ServletWrappingController controller = new ServletWrappingController();
|
||||
|
||||
@@ -116,6 +116,7 @@ public class JolokiaMvcEndpoint extends AbstractNamedMvcEndpoint
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,4 +49,5 @@ public class ShutdownMvcEndpoint extends EndpointMvcAdapter {
|
||||
}
|
||||
return super.invoke();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -50,4 +50,5 @@ public abstract class AbstractHealthIndicator implements HealthIndicator {
|
||||
* system status.
|
||||
*/
|
||||
protected abstract void doHealthCheck(Health.Builder builder) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -61,4 +61,5 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator {
|
||||
.withDetail("free", diskFreeInBytes)
|
||||
.withDetail("threshold", this.properties.getThreshold());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -299,6 +299,7 @@ public final class Health {
|
||||
public Health build() {
|
||||
return new Health(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,4 +42,5 @@ public interface HealthAggregator {
|
||||
* @return the aggregated health
|
||||
*/
|
||||
Health aggregate(Map<String, Health> healths);
|
||||
|
||||
}
|
||||
|
||||
@@ -167,6 +167,7 @@ public class DropwizardMetricServices implements CounterService, GaugeService {
|
||||
public void setValue(double value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -240,4 +240,5 @@ public class MetricCopyExporter extends AbstractMetricExporter {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,6 @@ public class OpenTsdbGaugeWriter implements GaugeWriter {
|
||||
/**
|
||||
* Creates a new {@code OpenTsdbGaugeWriter} with the given millisecond
|
||||
* {@code connectTimeout} and {@code readTimeout}.
|
||||
*
|
||||
* @param connectTimeout the connect timeout in milliseconds
|
||||
* @param readTimeout the read timeout in milliseconds
|
||||
*/
|
||||
|
||||
@@ -58,7 +58,6 @@ public class RedisMetricRepository implements MetricRepository {
|
||||
* Create a RedisMetricRepository with a default prefix to apply to all metric names.
|
||||
* If multiple repositories share a redis instance they will feed into the same global
|
||||
* metrics.
|
||||
*
|
||||
* @param redisConnectionFactory the redis connection factory
|
||||
*/
|
||||
public RedisMetricRepository(RedisConnectionFactory redisConnectionFactory) {
|
||||
@@ -70,7 +69,6 @@ public class RedisMetricRepository implements MetricRepository {
|
||||
* unique to this repository or to a logical repository contributed to by multiple
|
||||
* instances, where they all see the same values). Recommended constructor for general
|
||||
* purpose use.
|
||||
*
|
||||
* @param redisConnectionFactory the redis connection factory
|
||||
* @param prefix the prefix to set for all metrics keys
|
||||
*/
|
||||
@@ -84,7 +82,6 @@ public class RedisMetricRepository implements MetricRepository {
|
||||
* redis store will hold a zset under the key just so the metric names can be
|
||||
* enumerated. Read operations, especially {@link #findAll()} and {@link #count()},
|
||||
* will only be accurate if the key is unique to the prefix of this repository.
|
||||
*
|
||||
* @param redisConnectionFactory the redis connection factory
|
||||
* @param prefix the prefix to set for all metrics keys
|
||||
* @param key the key to set
|
||||
|
||||
@@ -51,4 +51,5 @@ final class RedisUtils {
|
||||
RedisConnectionFactory redisConnectionFactory) {
|
||||
return new StringRedisTemplate(redisConnectionFactory);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -78,4 +78,5 @@ public class InMemoryRichGaugeRepository implements RichGaugeRepository {
|
||||
public long count() {
|
||||
return this.repository.count();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ public class SimpleInMemoryRepository<T> {
|
||||
|
||||
/**
|
||||
* Callback used to update a value.
|
||||
*
|
||||
* @param <T> the value type
|
||||
*/
|
||||
public interface Callback<T> {
|
||||
|
||||
@@ -64,8 +64,8 @@ public class AuthorizationAuditListener extends AbstractAuthorizationAuditListen
|
||||
if (event.getAuthentication().getDetails() != null) {
|
||||
data.put("details", event.getAuthentication().getDetails());
|
||||
}
|
||||
publish(new AuditEvent(event.getAuthentication().getName(),
|
||||
AUTHORIZATION_FAILURE, data));
|
||||
publish(new AuditEvent(event.getAuthentication().getName(), AUTHORIZATION_FAILURE,
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ public class AuditAutoConfigurationTests {
|
||||
}
|
||||
|
||||
public static class TestAuditEventRepository extends InMemoryAuditEventRepository {
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -558,6 +558,7 @@ public class HealthIndicatorAutoConfigurationTests {
|
||||
public JestClient jestClient() {
|
||||
return mock(JestClient.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -274,11 +274,13 @@ public class ManagementWebSecurityAutoConfigurationTests {
|
||||
@EnableGlobalAuthentication
|
||||
@Configuration
|
||||
static class AuthenticationConfig {
|
||||
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.inMemoryAuthentication().withUser("user").password("password")
|
||||
.roles("USER");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -279,6 +279,7 @@ public class PublicMetricsAutoConfigurationTests {
|
||||
public DataSource commonsDbcpDataSource() {
|
||||
return InitializedBuilder.create().type(BasicDataSource.class).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -295,6 +296,7 @@ public class PublicMetricsAutoConfigurationTests {
|
||||
public DataSource commonsDbcpDataSource() {
|
||||
return InitializedBuilder.create().type(BasicDataSource.class).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -311,6 +313,7 @@ public class PublicMetricsAutoConfigurationTests {
|
||||
public DataSource dataSource() {
|
||||
return InitializedBuilder.create().type(BasicDataSource.class).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -326,6 +329,7 @@ public class PublicMetricsAutoConfigurationTests {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -386,4 +390,5 @@ public class PublicMetricsAutoConfigurationTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public class AutoConfigurationReportEndpointTests
|
||||
public AutoConfigurationReportEndpoint endpoint() {
|
||||
return new AutoConfigurationReportEndpoint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -87,10 +87,12 @@ public class ConfigurationPropertiesReportEndpointParentTests {
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
public static class Parent {
|
||||
|
||||
@Bean
|
||||
public TestProperties testProperties() {
|
||||
return new TestProperties();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -127,6 +129,7 @@ public class ConfigurationPropertiesReportEndpointParentTests {
|
||||
}
|
||||
|
||||
public static class OtherProperties {
|
||||
|
||||
}
|
||||
|
||||
@ConfigurationProperties(prefix = "test")
|
||||
@@ -143,4 +146,5 @@ public class ConfigurationPropertiesReportEndpointParentTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -318,6 +318,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
}
|
||||
|
||||
public static class Bar {
|
||||
|
||||
private String name = "123456";
|
||||
|
||||
public String getName() {
|
||||
@@ -327,6 +328,7 @@ public class ConfigurationPropertiesReportEndpointSerializationTests {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -186,10 +186,12 @@ public class ConfigurationPropertiesReportEndpointTests
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
public static class Parent {
|
||||
|
||||
@Bean
|
||||
public TestProperties testProperties() {
|
||||
return new TestProperties();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@@ -281,4 +283,5 @@ public class ConfigurationPropertiesReportEndpointTests
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,4 +54,5 @@ public class DumpEndpointTests extends AbstractEndpointTests<DumpEndpoint> {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -204,4 +204,5 @@ public class EnvironmentEndpointTests extends AbstractEndpointTests<EnvironmentE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -74,5 +74,7 @@ public class HealthEndpointTests extends AbstractEndpointTests<HealthEndpoint> {
|
||||
public HealthAggregator healthAggregator() {
|
||||
return new OrderedHealthAggregator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,4 +111,5 @@ public class MetricsEndpointTests extends AbstractEndpointTests<MetricsEndpoint>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -126,6 +126,7 @@ public class RequestMappingEndpointTests {
|
||||
|
||||
@Configuration
|
||||
protected static class MappingConfiguration {
|
||||
|
||||
@Bean
|
||||
@Lazy
|
||||
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
@@ -134,5 +135,7 @@ public class RequestMappingEndpointTests {
|
||||
mapping.setUrlMap(Collections.singletonMap("/foo", new Object()));
|
||||
return mapping;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,4 +102,5 @@ public class ShutdownEndpointTests extends AbstractEndpointTests<ShutdownEndpoin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -96,9 +96,12 @@ public class ShutdownParentEndpointTests {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
public static class Empty {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,5 +56,7 @@ public class TraceEndpointTests extends AbstractEndpointTests<TraceEndpoint> {
|
||||
repository.add(Collections.<String, Object>singletonMap("a", "b"));
|
||||
return new TraceEndpoint(repository);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -269,8 +269,8 @@ public class EndpointMBeanExporterTests {
|
||||
MBeanExporter mbeanExporter = registerLoggersEndpoint();
|
||||
Object response = mbeanExporter.getServer().invoke(
|
||||
getObjectName("loggersEndpoint", this.context), "setLogLevel",
|
||||
new Object[]{"com.example", "trace"},
|
||||
new String[]{String.class.getName(), String.class.getName()});
|
||||
new Object[] { "com.example", "trace" },
|
||||
new String[] { String.class.getName(), String.class.getName() });
|
||||
assertThat(response).isNull();
|
||||
}
|
||||
|
||||
@@ -280,10 +280,9 @@ public class EndpointMBeanExporterTests {
|
||||
this.thrown.expect(MBeanException.class);
|
||||
this.thrown.expectCause(hasMessage(containsString("No enum constant")));
|
||||
this.thrown.expectCause(hasMessage(containsString("LogLevel.INVALID")));
|
||||
mbeanExporter.getServer().invoke(
|
||||
getObjectName("loggersEndpoint", this.context), "setLogLevel",
|
||||
new Object[]{"com.example", "invalid"},
|
||||
new String[]{String.class.getName(), String.class.getName()});
|
||||
mbeanExporter.getServer().invoke(getObjectName("loggersEndpoint", this.context),
|
||||
"setLogLevel", new Object[] { "com.example", "invalid" },
|
||||
new String[] { String.class.getName(), String.class.getName() });
|
||||
}
|
||||
|
||||
private MBeanExporter registerLoggersEndpoint() {
|
||||
|
||||
@@ -90,14 +90,17 @@ public class JolokiaMvcEndpointContextPathTests {
|
||||
EndpointWebMvcAutoConfiguration.class, JolokiaAutoConfiguration.class,
|
||||
ManagementServerPropertiesAutoConfiguration.class })
|
||||
public static class Config {
|
||||
|
||||
}
|
||||
|
||||
public static class ContextPathListener
|
||||
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
|
||||
|
||||
@Override
|
||||
public void initialize(ConfigurableApplicationContext context) {
|
||||
EnvironmentTestUtils.addEnvironment(context, "management.contextPath:/admin");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ public class MvcEndpointsTests {
|
||||
public String invoke() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class TestMvcEndpoint extends EndpointMvcAdapter {
|
||||
@@ -108,6 +109,7 @@ public class MvcEndpointsTests {
|
||||
TestMvcEndpoint(Endpoint<?> delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class OtherTestMvcEndpoint extends EndpointMvcAdapter {
|
||||
@@ -115,6 +117,7 @@ public class MvcEndpointsTests {
|
||||
OtherTestMvcEndpoint(Endpoint<?> delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -235,4 +235,5 @@ public class ElasticsearchHealthIndicatorTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class DropwizardMetricServicesTests {
|
||||
|
||||
private final MetricRegistry registry = new MetricRegistry();
|
||||
|
||||
private final DropwizardMetricServices writer = new DropwizardMetricServices(
|
||||
this.registry);
|
||||
|
||||
@@ -89,7 +90,6 @@ public class DropwizardMetricServicesTests {
|
||||
* thread is updating the same set of metrics. This would be an example case of the
|
||||
* writer being used with the MetricsFilter handling several requests/sec to the same
|
||||
* URL.
|
||||
*
|
||||
* @throws Exception if an error occurs
|
||||
*/
|
||||
@Test
|
||||
|
||||
@@ -53,10 +53,12 @@ public class SpringIntegrationMetricReaderTests {
|
||||
@Configuration
|
||||
@Import({ JmxAutoConfiguration.class, IntegrationAutoConfiguration.class })
|
||||
protected static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public SpringIntegrationMetricReader reader(IntegrationMBeanExporter exporter) {
|
||||
return new SpringIntegrationMetricReader(exporter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,9 +32,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class MultiMetricRichGaugeReaderTests {
|
||||
|
||||
private InMemoryMetricRepository repository = new InMemoryMetricRepository();
|
||||
|
||||
private MultiMetricRichGaugeReader reader = new MultiMetricRichGaugeReader(
|
||||
this.repository);
|
||||
|
||||
private InMemoryRichGaugeRepository data = new InMemoryRichGaugeRepository();
|
||||
|
||||
private RichGaugeExporter exporter = new RichGaugeExporter(this.data,
|
||||
this.repository);
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ public class AuthenticationAuditListenerTests {
|
||||
AuditApplicationEvent event = handleAuthenticationEvent(
|
||||
new AuthenticationSwitchUserEvent(
|
||||
new UsernamePasswordAuthenticationToken("user", "password"),
|
||||
new User("user", "password",
|
||||
AuthorityUtils.commaSeparatedStringToAuthorityList("USER"))));
|
||||
new User("user", "password", AuthorityUtils
|
||||
.commaSeparatedStringToAuthorityList("USER"))));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_SWITCH);
|
||||
}
|
||||
@@ -98,12 +98,12 @@ public class AuthenticationAuditListenerTests {
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
|
||||
"user", "password");
|
||||
authentication.setDetails(details);
|
||||
AuditApplicationEvent event = handleAuthenticationEvent(new AuthenticationFailureExpiredEvent(
|
||||
authentication, new BadCredentialsException("Bad user")));
|
||||
AuditApplicationEvent event = handleAuthenticationEvent(
|
||||
new AuthenticationFailureExpiredEvent(authentication,
|
||||
new BadCredentialsException("Bad user")));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
|
||||
assertThat(event.getAuditEvent().getData())
|
||||
.containsEntry("details", details);
|
||||
assertThat(event.getAuditEvent().getData()).containsEntry("details", details);
|
||||
}
|
||||
|
||||
private AuditApplicationEvent handleAuthenticationEvent(
|
||||
|
||||
@@ -56,7 +56,8 @@ public class AuthorizationAuditListenerTests {
|
||||
public void testAuthenticationCredentialsNotFound() {
|
||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||
new AuthenticationCredentialsNotFoundEvent(this,
|
||||
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
||||
Collections.<ConfigAttribute>singletonList(
|
||||
new SecurityConfig("USER")),
|
||||
new AuthenticationCredentialsNotFoundException("Bad user")));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
|
||||
@@ -66,7 +67,8 @@ public class AuthorizationAuditListenerTests {
|
||||
public void testAuthorizationFailure() {
|
||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||
new AuthorizationFailureEvent(this,
|
||||
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
||||
Collections.<ConfigAttribute>singletonList(
|
||||
new SecurityConfig("USER")),
|
||||
new UsernamePasswordAuthenticationToken("user", "password"),
|
||||
new AccessDeniedException("Bad user")));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
@@ -81,7 +83,8 @@ public class AuthorizationAuditListenerTests {
|
||||
authentication.setDetails(details);
|
||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||
new AuthorizationFailureEvent(this,
|
||||
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
||||
Collections.<ConfigAttribute>singletonList(
|
||||
new SecurityConfig("USER")),
|
||||
authentication, new AccessDeniedException("Bad user")));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
.isEqualTo(AuthorizationAuditListener.AUTHORIZATION_FAILURE);
|
||||
|
||||
Reference in New Issue
Block a user