use of org.apereo.cas.authentication.bypass.audit.MultifactorAuthenticationProviderBypassAuditResourceResolver in project cas by apereo.
the class MultifactorAuthenticationProviderBypassAuditResourceResolverTests method verifyJsonOperation.
@Test
public void verifyJsonOperation() {
val applicationContext = new StaticApplicationContext();
applicationContext.refresh();
val resolver = new MultifactorAuthenticationProviderBypassAuditResourceResolver();
resolver.setAuditFormat(AuditTrailManager.AuditFormats.JSON);
val jp = mock(JoinPoint.class);
val args = new Object[] { MultifactorAuthenticationTestUtils.getAuthentication("casuser"), MultifactorAuthenticationTestUtils.getRegisteredService(), TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext) };
when(jp.getArgs()).thenReturn(args);
when(jp.getTarget()).thenReturn("TargetObject");
val outcome = resolver.resolveFrom(jp, new Object());
assertTrue(outcome.length > 0);
assertNotNull(resolver.resolveFrom(jp, new RuntimeException("failed")));
when(jp.getArgs()).thenReturn(null);
assertEquals(0, resolver.resolveFrom(jp, new Object()).length);
}
use of org.apereo.cas.authentication.bypass.audit.MultifactorAuthenticationProviderBypassAuditResourceResolver in project cas by apereo.
the class MultifactorAuthenticationProviderBypassAuditResourceResolverTests method verifyOperation.
@Test
public void verifyOperation() {
val applicationContext = new StaticApplicationContext();
applicationContext.refresh();
val resolver = new MultifactorAuthenticationProviderBypassAuditResourceResolver();
val jp = mock(JoinPoint.class);
val args = new Object[] { MultifactorAuthenticationTestUtils.getAuthentication("casuser"), MultifactorAuthenticationTestUtils.getRegisteredService(), TestMultifactorAuthenticationProvider.registerProviderIntoApplicationContext(applicationContext) };
when(jp.getArgs()).thenReturn(args);
when(jp.getTarget()).thenReturn("TargetObject");
val outcome = resolver.resolveFrom(jp, new Object());
assertTrue(outcome.length > 0);
assertNotNull(resolver.resolveFrom(jp, new RuntimeException("failed")));
when(jp.getArgs()).thenReturn(null);
assertEquals(0, resolver.resolveFrom(jp, new Object()).length);
}
Aggregations