use of org.cloudfoundry.identity.uaa.mock.util.InterceptingLogger in project uaa by cloudfoundry.
the class AuditCheckMockMvcTests method setUp.
@BeforeEach
void setUp(@Autowired FilterChainProxy springSecurityFilterChain, @Autowired WebApplicationContext webApplicationContext) throws Exception {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).addFilter(springSecurityFilterChain).build();
testClient = new TestClient(mockMvc);
originalLoginClient = clientRegistrationService.loadClientByClientId("login");
testAccounts = UaaTestAccounts.standard(null);
mockAuditService = mock(UaaAuditService.class);
testListener = TestApplicationEventListener.forEventClass(AbstractUaaEvent.class);
configurableApplicationContext.addApplicationListener(testListener);
auditListener = new AuditListener(mockAuditService);
configurableApplicationContext.addApplicationListener(auditListener);
testLogger = new InterceptingLogger();
originalAuditServiceLogger = loggingAuditService.getLogger();
loggingAuditService.setLogger(testLogger);
adminToken = testClient.getClientCredentialsOAuthAccessToken(testAccounts.getAdminClientId(), testAccounts.getAdminClientSecret(), "uaa.admin,scim.write");
testUser = createUser(adminToken, "testUser", "Test", "User", "testuser@test.com", testPassword, true);
resetAuditTestReceivers();
authSuccessListener = mock(new DefaultApplicationListener<UserAuthenticationSuccessEvent>() {
}.getClass());
configurableApplicationContext.addApplicationListener(authSuccessListener);
mgr.setAllowUnverifiedUsers(false);
}
use of org.cloudfoundry.identity.uaa.mock.util.InterceptingLogger in project uaa by cloudfoundry.
the class AbstractLdapMockMvcTest method setUp.
@BeforeEach
void setUp(@Autowired WebApplicationContext webApplicationContext, @Autowired MockMvc mockMvc, @Autowired ConfigurableApplicationContext configurableApplicationContext, @Autowired JdbcScimUserProvisioning jdbcScimUserProvisioning, @Autowired LoggingAuditService loggingAuditService) throws Exception {
this.webApplicationContext = webApplicationContext;
this.mockMvc = mockMvc;
this.jdbcScimUserProvisioning = jdbcScimUserProvisioning;
this.loggingAuditService = loggingAuditService;
String userId = new RandomValueStringGenerator().generate().toLowerCase();
zone = MockMvcUtils.createZoneForInvites(getMockMvc(), getWebApplicationContext(), userId, REDIRECT_URI, IdentityZoneHolder.getCurrentZoneId());
LdapIdentityProviderDefinition definition = new LdapIdentityProviderDefinition();
definition.setLdapProfileFile("ldap/" + ldapProfile);
definition.setLdapGroupFile("ldap/" + ldapGroup);
definition.setMaxGroupSearchDepth(10);
definition.setBaseUrl(getLdapOrLdapSBaseUrl());
definition.setBindUserDn("cn=admin,ou=Users,dc=test,dc=com");
definition.setBindPassword("adminsecret");
definition.setSkipSSLVerification(false);
definition.setTlsConfiguration(tlsConfig);
definition.setMailAttributeName("mail");
definition.setReferral("ignore");
provider = MockMvcUtils.createIdentityProvider(getMockMvc(), zone.getZone(), LDAP, definition);
host = zone.getZone().getIdentityZone().getSubdomain() + ".localhost";
IdentityZoneHolder.clear();
listener = (ApplicationListener<AbstractUaaEvent>) mock(ApplicationListener.class);
configurableApplicationContext.addApplicationListener(listener);
ensureLdapServerIsRunning();
testLogger = new InterceptingLogger();
originalAuditServiceLogger = loggingAuditService.getLogger();
loggingAuditService.setLogger(testLogger);
}
use of org.cloudfoundry.identity.uaa.mock.util.InterceptingLogger in project uaa by cloudfoundry.
the class SamlAuthenticationMockMvcTests method installTestLogger.
@BeforeEach
void installTestLogger() {
testLogger = new InterceptingLogger();
originalAuditServiceLogger = loggingAuditService.getLogger();
loggingAuditService.setLogger(testLogger);
}
Aggregations