Search in sources :

Example 1 with AuditServiceProvider

use of org.forgerock.openam.audit.AuditServiceProvider in project OpenAM by OpenRock.

the class RestRouterIT method setupMocks.

@BeforeMethod
public void setupMocks() {
    MockitoAnnotations.initMocks(this);
    configResource = mock(SingletonResourceProvider.class);
    usersResource = mock(CollectionResourceProvider.class);
    internalResource = mock(CollectionResourceProvider.class);
    dashboardResource = spy(new DashboardResource());
    authenticateResource = spy(new AuthenticateResource());
    httpAccessAuditFilter = spy(new AbstractHttpAccessAuditFilter(AUTHENTICATION, mock(AuditEventPublisher.class), mock(AuditEventFactory.class)) {

        @Override
        protected String getRealm(Context context) {
            return null;
        }
    });
    auditEventPublisher = mock(AuditEventPublisher.class);
    auditServiceProvider = mock(AuditServiceProvider.class);
    versionBehaviourManager = mock(ResourceApiVersionBehaviourManager.class);
    ssoTokenManager = mock(SSOTokenManager.class);
    authUtilsWrapper = mock(AuthUtilsWrapper.class);
    coreWrapper = mock(CoreWrapper.class);
    SSOToken adminToken = mock(SSOToken.class);
    given(coreWrapper.getAdminToken()).willReturn(adminToken);
    given(coreWrapper.isValidFQDN(anyString())).willReturn(true);
    realmValidator = mock(RestRealmValidator.class);
}
Also used : RootContext(org.forgerock.services.context.RootContext) RequestAuditContext(org.forgerock.services.context.RequestAuditContext) HttpContext(org.forgerock.json.resource.http.HttpContext) SessionContext(org.forgerock.http.session.SessionContext) SSOTokenContext(org.forgerock.openam.rest.resource.SSOTokenContext) AttributesContext(org.forgerock.services.context.AttributesContext) SecurityContext(org.forgerock.services.context.SecurityContext) Context(org.forgerock.services.context.Context) SSOTokenManager(com.iplanet.sso.SSOTokenManager) CoreWrapper(org.forgerock.openam.core.CoreWrapper) AuditServiceProvider(org.forgerock.openam.audit.AuditServiceProvider) SSOToken(com.iplanet.sso.SSOToken) SingletonResourceProvider(org.forgerock.json.resource.SingletonResourceProvider) AuditEventPublisher(org.forgerock.openam.audit.AuditEventPublisher) CollectionResourceProvider(org.forgerock.json.resource.CollectionResourceProvider) AuthUtilsWrapper(org.forgerock.openam.authentication.service.AuthUtilsWrapper) AuditEventFactory(org.forgerock.openam.audit.AuditEventFactory) ResourceApiVersionBehaviourManager(org.forgerock.http.routing.ResourceApiVersionBehaviourManager) RestRealmValidator(org.forgerock.openam.rest.router.RestRealmValidator) AbstractHttpAccessAuditFilter(org.forgerock.openam.audit.AbstractHttpAccessAuditFilter) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with AuditServiceProvider

use of org.forgerock.openam.audit.AuditServiceProvider in project OpenAM by OpenRock.

the class AbstractRestletAccessAuditFilterTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    restlet = mock(Restlet.class);
    AMAuditServiceConfiguration serviceConfig = new AMAuditServiceConfiguration(true);
    AuditServiceBuilder builder = AuditServiceBuilder.newAuditService().withConfiguration(serviceConfig);
    AMAuditService auditService = new DefaultAuditServiceProxy(builder.build(), serviceConfig);
    auditService.startup();
    auditServiceProvider = mock(AuditServiceProvider.class);
    when(auditServiceProvider.getDefaultAuditService()).thenReturn(auditService);
    eventFactory = new AuditEventFactory();
    eventPublisher = mock(AuditEventPublisher.class);
    auditFilter = new RestletAccessAuditFilterTest(restlet, eventPublisher, eventFactory, null, null);
}
Also used : AuditServiceBuilder(org.forgerock.audit.AuditServiceBuilder) DefaultAuditServiceProxy(org.forgerock.openam.audit.DefaultAuditServiceProxy) AuditServiceProvider(org.forgerock.openam.audit.AuditServiceProvider) Restlet(org.restlet.Restlet) AMAuditService(org.forgerock.openam.audit.AMAuditService) AuditEventFactory(org.forgerock.openam.audit.AuditEventFactory) AMAuditServiceConfiguration(org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration) AuditEventPublisher(org.forgerock.openam.audit.AuditEventPublisher) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

AuditEventFactory (org.forgerock.openam.audit.AuditEventFactory)2 AuditEventPublisher (org.forgerock.openam.audit.AuditEventPublisher)2 AuditServiceProvider (org.forgerock.openam.audit.AuditServiceProvider)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 SSOToken (com.iplanet.sso.SSOToken)1 SSOTokenManager (com.iplanet.sso.SSOTokenManager)1 AuditServiceBuilder (org.forgerock.audit.AuditServiceBuilder)1 ResourceApiVersionBehaviourManager (org.forgerock.http.routing.ResourceApiVersionBehaviourManager)1 SessionContext (org.forgerock.http.session.SessionContext)1 CollectionResourceProvider (org.forgerock.json.resource.CollectionResourceProvider)1 SingletonResourceProvider (org.forgerock.json.resource.SingletonResourceProvider)1 HttpContext (org.forgerock.json.resource.http.HttpContext)1 AMAuditService (org.forgerock.openam.audit.AMAuditService)1 AbstractHttpAccessAuditFilter (org.forgerock.openam.audit.AbstractHttpAccessAuditFilter)1 DefaultAuditServiceProxy (org.forgerock.openam.audit.DefaultAuditServiceProxy)1 AMAuditServiceConfiguration (org.forgerock.openam.audit.configuration.AMAuditServiceConfiguration)1 AuthUtilsWrapper (org.forgerock.openam.authentication.service.AuthUtilsWrapper)1 CoreWrapper (org.forgerock.openam.core.CoreWrapper)1 SSOTokenContext (org.forgerock.openam.rest.resource.SSOTokenContext)1 RestRealmValidator (org.forgerock.openam.rest.router.RestRealmValidator)1